private void button1_Click(object sender, EventArgs e) { FORM_ADD_PRODUCT frm = new FORM_ADD_PRODUCT(); frm.ShowDialog(); frm.txtRef.Focus(); }
public FORM_ADD_PRODUCT() { InitializeComponent(); if (frm == null) /*بعين قيمة لل form لو قيمتة ب null وهى تكون قيمتها الحالية */ // .......[4] { frm = this; } cmbCategories.DataSource = prd.GET_ALL_CATEGORIES(); cmbCategories.DisplayMember = "CatName"; cmbCategories.ValueMember = "CatID"; cmbCategories.SelectedIndex = -1; labeladd.Visible = false; // ل اخفاء ليبل حالة المنتج من الفرم }
private void button3_Click(object sender, EventArgs e) { FORM_ADD_PRODUCT form = new FORM_ADD_PRODUCT(); form.button1.Visible = false; form.txtRef.Text = this.dataGridView1.CurrentRow.Cells[0].Value.ToString(); form.txtDes.Text = this.dataGridView1.CurrentRow.Cells[1].Value.ToString(); form.txtqte.Text = this.dataGridView1.CurrentRow.Cells[5].Value.ToString(); form.txt_P_Price.Text = this.dataGridView1.CurrentRow.Cells[3].Value.ToString(); form.txt_S_price.Text = this.dataGridView1.CurrentRow.Cells[4].Value.ToString(); form.cmbCategories.Text = this.dataGridView1.CurrentRow.Cells[6].Value.ToString(); form.Text = "Product Update:" + this.dataGridView1.CurrentRow.Cells[1].Value.ToString(); form.btnAdd.Text = "Update"; form.state = "update"; form.txtRef.ReadOnly = true; form.ShowDialog(); }
private void addANewProductToolStripMenuItem_Click(object sender, EventArgs e) { FORM_ADD_PRODUCT frm = new FORM_ADD_PRODUCT(); frm.ShowDialog(); }
private static FORM_ADD_PRODUCT frm; // ......................[1] static void frm_formclosed(object sender, FormClosedEventArgs e) // ................[2] { frm = null; }