private void btnAddClick(object sender, EventArgs e) { try { AddingForm adf = new AddingForm(1, null); adf.ShowDialog(); btnGetClick(null, null); } catch (FormatException ex) { lblInfo.Text = "Отменено"; } }
private void btnModifyClick(object sender, EventArgs e) { str = new String[9]; try { int si = dataGridView.SelectedCells[0].RowIndex; DataGridViewRow dr = dataGridView.Rows[si]; for (int i = 0; i != dr.Cells.Count; i++) { str[i] = Convert.ToString(dr.Cells[i].Value); } AddingForm adf = new AddingForm(2, str); adf.ShowDialog(); btnGetClick(null,null); dataGridView.CurrentCell = dataGridView.Rows[si].Cells[0]; } catch (NullReferenceException ex) { lblInfo.Text = "Выберите только одну строку для редактирования"; } catch (FormatException ex) { lblInfo.Text = "Отменено"; } }