private void warehouseToolStripMenuItem1_Click(object sender, EventArgs e) { try { AddNewWarehouse ARF = null; if (IsFormAlreadyOpen(typeof(AddNewWarehouse)) == null) { ARF = new AddNewWarehouse(); ARF.MdiParent = this; ARF.Show(); } else { Form selectedForm = IsFormAlreadyOpen(typeof(AddNewWarehouse)); 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()); } }