private void mnuAddressBook_Click(object sender, EventArgs e) { if (objAddressForm == null) { objAddressForm = new AddressbookForm(); objAddressForm.MdiParent = this; objAddressForm.Show(); objAddressForm.FormClosing += objAddressForm_FormClosing; } else { objAddressForm.Activate(); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); LoginForm obj = new LoginForm(); Form frm; if (obj.ShowDialog() == DialogResult.OK) { if (Helper.Role == "Admin") { frm = new MDIParentForm(); } else { frm = new AddressbookForm(); } Application.Run(frm); } }
void objAddressForm_FormClosing(object sender, FormClosingEventArgs e) { objAddressForm = null; }