Exemple #1
0
        private void buttonAddChild_Click(object sender, EventArgs e)
        {
            child c = new child();
            c.name.first = textBoxChildFirstName.Text;
            c.name.middle = textBoxChildMiddleName.Text;
            c.name.last = textBoxChildLastName.Text;
            c.name.maiden = textBoxChildMaidenName.Text;
            try
            {
                c.spouseID = ((comboMother)comboBoxMother.SelectedItem).mother.id;
            }
            catch
            {
                c.spouseID = 0;
            }

            string[] childLine = { c.ToString() };
            ListViewItem newItem = new ListViewItem(childLine);
            newItem.Tag = c;
            listViewChildren.Items.Add(newItem);

            //clear
            textBoxChildFirstName.Clear();
            textBoxChildLastName.Clear();
            textBoxChildMaidenName.Clear();
            textBoxChildMiddleName.Clear();
            comboBoxMother.SelectedIndex = 0;
        }