private void AddBtn_Click(object sender, EventArgs e) { try { ChangeForm form = new ChangeForm(); if (form.ShowDialog() == DialogResult.OK) { list.Add(form.student); SetDGV(); } } catch (Exception) { MessageBox.Show("некорректный ввод", "Error"); } }
private void DGV_MouseDoubleClick(object sender, MouseEventArgs e) { int i = DGV.CurrentCell.RowIndex; if (i >= 0 && i < list.Count) { try { ChangeForm form = new ChangeForm(); form.student = list[i]; form.ShowDialog(); SetDGV(); } catch (Exception) { MessageBox.Show("некорректный ввод", "Error"); } } }