private void supplierToolStripMenuItem1_Click(object sender, EventArgs e) { try { AddNewSupplier ARF = null; if (IsFormAlreadyOpen(typeof(AddNewSupplier)) == null) { ARF = new AddNewSupplier(); ARF.MdiParent = this; ARF.Show(); } else { Form selectedForm = IsFormAlreadyOpen(typeof(AddNewSupplier)); foreach (Form OpenForm in this.MdiChildren) { if (OpenForm == selectedForm) { if (selectedForm.WindowState == FormWindowState.Minimized) { selectedForm.WindowState = FormWindowState.Normal; } selectedForm.Select(); } } } } catch (Exception x) { MessageBox.Show(x.GetBaseException().ToString()); } }
public void showAddNewSupplierForm() { try { AddNewSupplier ARF = null; if (IsFormAlreadyOpen(typeof(AddNewSupplier)) == null) { ARF = new AddNewSupplier(); ARF.MdiParent = this.MdiParent; ARF.Show(); } else { Form selectedForm = IsFormAlreadyOpen(typeof(AddNewSupplier)); foreach (Form OpenForm in this.MdiChildren) { if (OpenForm == selectedForm) { if (selectedForm.WindowState == FormWindowState.Minimized) { selectedForm.WindowState = FormWindowState.Normal; } selectedForm.Select(); } } } } catch (Exception x) { MessageBox.Show(x.GetBaseException().ToString()); } }