// add new product button, shows the form for adding new product "frm_addProduct" private void button1_Click(object sender, EventArgs e) { frm_addProduct f = new frm_addProduct(); // pass this form by reference to another form to make the other form control this form // which is used to refresh this form after adding a new product from the "add new product" form f.setMngProdctsVar = this; f.ShowDialog(); }
private void edtSlctdPrdct_Click(object sender, EventArgs e) { frm_addProduct f = new frm_addProduct(); f.Text = "تحديث بيانات : " + this.dgvProductsLst.CurrentRow.Cells[1].Value.ToString(); f.txtProdName.Text = this.dgvProductsLst.CurrentRow.Cells[1].Value.ToString(); f.txtProductNotes.Text = this.dgvProductsLst.CurrentRow.Cells[4].Value.ToString(); f.alrtQntnumericUpDown.Value = Convert.ToInt32(this.dgvProductsLst.CurrentRow.Cells[3].Value); f.cmbSplrs.Text = this.dgvProductsLst.CurrentRow.Cells[5].Value.ToString(); f.cmbCats.Text = this.dgvProductsLst.CurrentRow.Cells[6].Value.ToString(); f.cmbMsrUnt.Text = f.textBox1.Text = this.dgvProductsLst.CurrentRow.Cells[7].Value.ToString(); f.btnAddProduct.Text = "تحديث"; f.pictureBox1.Image = productImg.Image; // change the state of the form to update state, Default state: add f._formState = "update"; f._productIDToUpdt = Convert.ToInt16(this.dgvProductsLst.CurrentRow.Cells[0].Value.ToString()); f.ShowDialog(); }
private void addNewProductToolStripMenuItem_Click(object sender, EventArgs e) { frm_addProduct f = new frm_addProduct(); f.ShowDialog(); }