private void AddConsignor(object sender, EventArgs e) { Consignor consignor = null; AddEditConsignorForm addEditConsignorForm = new AddEditConsignorForm(consignor); addEditConsignorForm.ShowDialog(); addEditConsignorForm.Dispose(); dataGridViewAll.Refresh(); }
//edit when double click private void EditConsignor(Object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0)//not header row { int consignorId = int.Parse(dataGridViewAll.Rows[e.RowIndex].Cells[0].Value.ToString()); Consignor consignor = context.Consignors.Find(consignorId); AddEditConsignorForm addEditConsignorForm = new AddEditConsignorForm(consignor); addEditConsignorForm.ShowDialog(); dataGridViewAll.Refresh(); } }