private void BtAdd_Click(object sender, EventArgs e) { using (InputDriverForm inForm = new InputDriverForm()) { if (inForm.ShowDialog() == DialogResult.OK) { drivers.Add(inForm.driver); UpdateDgv(); } } }
private void ChangeRow(DataGridViewRow row) { using (InputDriverForm inForm = new InputDriverForm((Driver)row.DataBoundItem)) { inForm.EditOrFind(); if (inForm.DialogResult == DialogResult.OK) { drivers.Add(inForm.driver); UpdateDgv(); } } }
private void BtEdit_Click(object sender, EventArgs e) { if (dgv.SelectedRows.Count == 0) { MessageBox.Show("Выберите строку"); return; } int rowIndex = dgv.SelectedRows[0].Index; Driver driver = (Driver)dgv.SelectedRows[0].DataBoundItem; using (InputDriverForm inputBookForm = new InputDriverForm(driver)) { inputBookForm.EditOrFind(); if (inputBookForm.ShowDialog() != DialogResult.OK) { return; } driver = inputBookForm.driver; drivers.Add(driver); UpdateDgv(); } }