private void ADD_Load(object sender, EventArgs e) { if (ManegarOrEmployee.res == null) { ManegarOrEmployee ask = new ManegarOrEmployee(); ask.Show(); this.Close(); } try { ad = new SqlDataAdapter("select * from Department", connection.con); ad.Fill(dt); comboDepar.DataSource = dt; comboDepar.DisplayMember = "D_Name"; comboDepar.ValueMember = "D_id"; comboDepar.Text = ""; } catch { return; } label.Text = ManegarOrEmployee.res; but_AddNew.Enabled = false; }
private void ADD_FormClosing(object sender, FormClosingEventArgs e) { if (ManegarOrEmployee.res != null) { DialogResult res2; res2 = MessageBox.Show("do you want another add ?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res2 == DialogResult.Yes) { ManegarOrEmployee.res = null; ManegarOrEmployee ask = new ManegarOrEmployee(); ask.Show(); this.Close(); } else { ManegarOrEmployee.res = null; } } }