//Buttons (add/edit or delete) private void btnAddProduct_Click(object sender, EventArgs e) { disableButtons(); Product product = new Product(); ProductForm addProduct = new ProductForm(product); addProduct.Show(); }
private void btnEditProduct_Click(object sender, EventArgs e) { if (LV_products.SelectedItems.Count > 0) { //uses selected value to find in the DB and passes it through in the next form var ProductID = LV_products.SelectedItems[0].Tag; Product selectedProduct = Program.db.Products.Find(ProductID); ProductForm editProduct = new ProductForm(selectedProduct); disableButtons(); editProduct.Show(); } }