private void AddFigureButton_Click(object sender, EventArgs e) { var form = new AddForm(); if (form.ShowDialog() == DialogResult.OK) { iFigureBindingSource.Add(form.Figure); } }
private void ModifyFigureButton_Click(object sender, EventArgs e) { if (iFigureBindingSource.Current == null) { MessageBox.Show(@"Вы не выбрали строку, которую хотите изменить.", @"Ошибка!"); } else { var index = FigureDataGridView.SelectedCells[0].RowIndex; var form = new AddForm { Figure = _figures[index] }; if (form.ShowDialog() == DialogResult.OK) { iFigureBindingSource.RemoveAt(index); iFigureBindingSource.Insert(index, form.Figure); } } }