private void btnAddProduct_Click(object sender, EventArgs e) { var addEditProduct = new AddEditProduct(this); addEditProduct.MdiParent = this.MdiParent; addEditProduct.Show(); }
private void addProductsToolStripMenuItem_Click(object sender, EventArgs e) { var addProduct = new AddEditProduct { MdiParent = this }; addProduct.Show(); }
private void btnEditProduct_Click(object sender, EventArgs e) { try { //select row var id = Convert.ToString(gvProductList.CurrentRow.Cells[0].Value); //query database for record var product = _db.Products.FirstOrDefault(p => p.ProdName == id); //launch AddEditProduct window with Data var addEditProduct = new AddEditProduct(product, this); addEditProduct.MdiParent = this.MdiParent; addEditProduct.Show(); } catch (Exception ex) { MessageBox.Show($"Error: {ex.Message}"); } }