private void btnEdit_Click(object sender, EventArgs e) { if (gridViewPerson.SelectedRows.Count > 0) { var _selectedRow = gridViewPerson.CurrentRow; Person _person = (Person)_selectedRow.DataBoundItem; PersonOperation frm = new PersonOperation(); frm.EditedPerson = _person; } else { MessageBox.Show("Please select a person!"); } }
private void btn_Add_Click(object sender, EventArgs e) { using (PersonOperation frm = new PersonOperation()) { Person _person = new Person() { TCNo = "308451234", Surname = "Erturk", Name = "Dilay", Gender = "Female", Birthday = "1996-08-06" }; frm.EditedPerson = _person; if (frm.ShowDialog() == DialogResult.OK) { personList.Add(_person); } } }