private void serviceRenderingsGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex >= 0) { var row = serviceRenderingsGridView.Rows[e.RowIndex]; ServiceRendering serviceRendering = row.Tag as ServiceRendering; using (var f = new EditServiceRenderingForm(schedule.Id, serviceRendering.Id)) { f.Saved += (s, eventArgs) => { ServiceRenderingsGridViewRenderRow(row, f.ServiceRendering); f.Close(); }; f.ShowDialog(); } } }
private void addServiceRenderingButton_Click(object sender, EventArgs e) { DataGridViewRow row = null; using (var f = new EditServiceRenderingForm(schedule.Id)) { f.Saved += (s, eventArgs) => { if (row == null) { row = serviceRenderingsGridView.Rows[serviceRenderingsGridView.Rows.Add()]; } ServiceRenderingsGridViewRenderRow(row, f.ServiceRendering); f.Close(); }; f.ShowDialog(); } }