Пример #1
0
        private void btnAddPerson_Click(object sender, EventArgs e)
        {
            AddPersonDialog form = new AddPersonDialog();

            form.ShowDialog();
            if (form.Person != null)
            {
                _people.Add(form.Person);
                FillRows();
            }
        }
Пример #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 0)
            {
                return;
            }
            DataGridViewRow selectedRow    = dataGridView1.SelectedRows[0];
            Person          SelectedPerson = _people[selectedRow.Index];
            AddPersonDialog EditForm       = new AddPersonDialog(true, SelectedPerson);

            EditForm.ShowDialog();
            Person editedPerson = EditForm.Person;

            _people[selectedRow.Index] = EditForm.Person;
            if (editedPerson == null)
            {
                return;
            }
            FillRows();
        }