private void btn_add_Click(object sender, EventArgs e) { FORM_USER frm = new FORM_USER(); frm.btn_add.Text = "Saved User"; frm.ShowDialog(); }
public FORM_USER() { InitializeComponent(); if (frm == null) /*بعين قيمة لل form لو قيمتة ب null وهى تكون قيمتها الحالية */ // .......[4] { frm = this; } }
private void btn_update_Click(object sender, EventArgs e) { FORM_USER frm = new FORM_USER(); frm.text_id_user.Text = this.DGV_user.CurrentRow.Cells[0].Value.ToString(); frm.text_name_user.Text = this.DGV_user.CurrentRow.Cells[1].Value.ToString(); frm.text_Fname_user.Text = this.DGV_user.CurrentRow.Cells[3].Value.ToString(); frm.text_PW_user.Text = this.DGV_user.CurrentRow.Cells[2].Value.ToString(); frm.text_PH_user.Text = this.DGV_user.CurrentRow.Cells[5].Value.ToString(); frm.com_Position_user.Text = this.DGV_user.CurrentRow.Cells[4].Value.ToString(); frm.Text = "User Update:" + this.DGV_user.CurrentRow.Cells[1].Value.ToString(); frm.btn_add.Text = "Update"; frm.state = "update"; frm.text_id_user.ReadOnly = true; frm.ShowDialog(); }
private void addToolStripMenuItem_Click(object sender, EventArgs e) { FORM_USER frm = new FORM_USER(); frm.ShowDialog(); }
private static FORM_USER frm; // ......................[1] static void frm_formclosed(object sender, FormClosedEventArgs e) // ................[2] { frm = null; }