private void mnuMasters_Click(object sender, EventArgs e) { bool formExists = false; foreach (Form childForm in MdiChildren) { if (childForm.Name == "frmMASTERS") { formExists = true; childForm.Show(); childForm.WindowState = FormWindowState.Maximized; } } if (!formExists) { frmMODULE frm = new frmMODULE(APP_MODULES.MASTERS); frm.Name = "frmMASTERS"; frm.MdiParent = this; frm.WindowState = FormWindowState.Maximized; frm.Text = "MASTER MANAGEMENT"; frm.Show(); } Application.DoEvents(); }
private void mnuHR_Click(object sender, EventArgs e) { bool formExists = false; foreach (Form childForm in MdiChildren) { if (childForm.Name == "frmHR") { formExists = true; childForm.Show(); childForm.WindowState = FormWindowState.Maximized; } } if (!formExists) { frmMODULE frm = new frmMODULE(APP_MODULES.HR); frm.Name = "frmHR"; frm.MdiParent = this; frm.WindowState = FormWindowState.Maximized; frm.Text = "HR MANAGEMENT"; frm.Show(); } }
private void mnuMyInfo_Click(object sender, EventArgs e) { bool formExists = false; try { foreach (Form childForm in MdiChildren) { if (childForm.Name == "frmUSER_INFO") { formExists = true; childForm.Show(); childForm.WindowState = FormWindowState.Maximized; return; } } if (!formExists) { frmMODULE frm = new frmMODULE(APP_MODULES.USER_INFO); frm.Name = "frmUSER_INFO"; frm.MdiParent = this; frm.WindowState = FormWindowState.Maximized; frm.Text = "MY INFO"; frm.Show(); } Application.DoEvents(); } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "frmMDI::mnuMyInfo_Click", MessageBoxButtons.OK, MessageBoxIcon.Error); } }