private void Edit_Button_Click_1(object sender, EventArgs e) { if (dataGridView_MyLots.SelectedRows.Count != 1) { return; } int index = dataGridView_MyLots.SelectedRows[0].Index; int indexInDataBase = Convert.ToInt32(dataGridView_MyLots[0, index].Value.ToString()); Lot choosedLot = lotRepository.Get(indexInDataBase); EditLotForm editLotForm = new EditLotForm(choosedLot); editLotForm.Show(); }
private void editLot() { var selectedProd = SelectedProduct; var selected = SelectedLot; editLotForm = new EditLotForm(selected); editLotForm.MaximizeBox = false; editLotForm.MinimizeBox = false; editLotForm.ShowDialog(); using (var db = new WereDesktopEntities()) { lotBindingSource1.DataSource = db.Lot.Where(l => l.ProductID == selectedProd.ID).ToList(); productBindingSource.DataSource = db.Product.ToList(); } }