private void addUnit_Click(object sender, EventArgs e) { var dialogResult = new AddOrEditSimpleEntity(new Unit(), _connectionString).ShowDialog(this); if (dialogResult == DialogResult.OK) { FillOrRefreshGridOfUnits(); } }
private void editUnit_Click(object sender, EventArgs e) { var selectedUnitRow = dataGridViewUnits.SelectedRows[0]; var selectedUnit = ((Unit)selectedUnitRow.DataBoundItem); var dialogResult = new AddOrEditSimpleEntity(selectedUnit, _connectionString).ShowDialog(this); if (dialogResult == DialogResult.OK) { FillOrRefreshGridOfUnits(); } }