private void customersToolStripMenuItem_Click(object sender, EventArgs e) { if (Application.OpenForms.OfType <formCustomers>().Count() == 0) { frmCustomers = new formCustomers(); frmCustomers.MdiParent = this; frmCustomers.Dock = DockStyle.Fill; frmCustomers.Show(); frmCustomers.BringToFront(); frmCustomers.WindowState = FormWindowState.Minimized; frmCustomers.WindowState = FormWindowState.Maximized; } else { reopenTheForm(typeof(formCustomers)); } }
private void btnCustomers_Click(object sender, EventArgs e) { if (Application.OpenForms.OfType <formCustomers>().Count() == 0) { frmCustomers = new formCustomers(); // Set the Parent Form of the Child window. frmCustomers.MdiParent = MdiParent; // Fill the parent form and bring it to front. frmCustomers.Dock = DockStyle.Fill; // Display the new form and maximize to fill the parent MDI. frmCustomers.Show(); frmCustomers.BringToFront(); frmCustomers.WindowState = FormWindowState.Minimized; frmCustomers.WindowState = FormWindowState.Maximized; } else { formBERP.reopenTheForm(typeof(formCustomers)); } }