private void addButton_Click(object sender, EventArgs e) { using (var f = new EditClientForm()) { DataGridViewRow row = null; f.Saved += (s, eventArgs) => { if (row == null) { row = clientsGridView.Rows[clientsGridView.Rows.Add()]; row.Selected = true; } ClientsGridViewRenderRow(row, f.Client); f.Close(); }; f.ShowDialog(); } }
private void clientsGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex >= 0) { var row = clientsGridView.Rows[e.RowIndex]; Client client = row.Tag as Client; using (var f = new EditClientForm(client.Id)) { f.Saved += (s, eventArgs) => { ClientsGridViewRenderRow(row, f.Client); f.Close(); }; f.ShowDialog(); } } }