public void ShowForm(string formName) { try { switch (formName) { // case "UserRegistration": // if (frmUserRegistration == null) // { // frmUserRegistration = new frmUserRegistration(); // frmUserRegistration.MdiParent = this; // frmUserRegistration.Show(); // frmUserRegistration.BringToFront(); // } // else if (frmUserRegistration.IsDisposed == true) // { // frmUserRegistration = new frmUserRegistration(); // frmUserRegistration.MdiParent = this; // frmUserRegistration.Show(); // frmUserRegistration.BringToFront(); // } // else // { // frmUserRegistration.Activate(); // frmUserRegistration.Show(); // frmUserRegistration.BringToFront(); // } // break; case "frmItemMaster": if (frmItemMaster == null) { frmItemMaster = new frmItemMaster(); frmItemMaster.MdiParent = this; frmItemMaster.Show(); frmItemMaster.BringToFront(); } else if (frmItemMaster.IsDisposed == true) { frmItemMaster = new frmItemMaster(); frmItemMaster.MdiParent = this; frmItemMaster.Show(); frmItemMaster.BringToFront(); } else { frmItemMaster.Activate(); frmItemMaster.Show(); frmItemMaster.BringToFront(); } break; case "frmTransactionIn": if (frmTransactionIn == null) { frmTransactionIn = new frmTransactionIn(); frmTransactionIn.MdiParent = this; frmTransactionIn.Show(); frmTransactionIn.BringToFront(); } else if (frmTransactionIn.IsDisposed == true) { frmTransactionIn = new frmTransactionIn(); frmTransactionIn.MdiParent = this; frmTransactionIn.Show(); frmTransactionIn.BringToFront(); } else { frmTransactionIn.Activate(); frmTransactionIn.Show(); frmTransactionIn.BringToFront(); } break; case "frmTransactionOut": if (frmTransactionOut == null) { frmTransactionOut = new frmTransactionOut(); frmTransactionOut.MdiParent = this; frmTransactionOut.Show(); frmTransactionOut.BringToFront(); } else if (frmTransactionOut.IsDisposed == true) { frmTransactionOut = new frmTransactionOut(); frmTransactionOut.MdiParent = this; frmTransactionOut.Show(); frmTransactionOut.BringToFront(); } else { frmTransactionOut.Activate(); frmTransactionOut.Show(); frmTransactionOut.BringToFront(); } break; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void ShowForm(string formName) { try { switch (formName) { case "frmItemMaster": if (frmItemMaster == null) { frmItemMaster = new frmItemMaster(); frmItemMaster.MdiParent = this; frmItemMaster.Show(); frmItemMaster.BringToFront(); } else if (frmItemMaster.IsDisposed == true) { frmItemMaster = new frmItemMaster(); frmItemMaster.MdiParent = this; frmItemMaster.Show(); frmItemMaster.BringToFront(); } else { frmItemMaster.Activate(); frmItemMaster.Show(); frmItemMaster.BringToFront(); } break; case "frmTransactionIn": if (frmTransactionIn == null) { frmTransactionIn = new frmTransactionIn(); frmTransactionIn.MdiParent = this; frmTransactionIn.Show(); frmTransactionIn.BringToFront(); } else if (frmTransactionIn.IsDisposed == true) { frmTransactionIn = new frmTransactionIn(); frmTransactionIn.MdiParent = this; frmTransactionIn.Show(); frmTransactionIn.BringToFront(); } else { frmTransactionIn.Activate(); frmTransactionIn.Show(); frmTransactionIn.BringToFront(); } break; case "frmTransactionOut": if (frmTransactionOut == null) { frmTransactionOut = new frmTransactionOut(); frmTransactionOut.MdiParent = this; frmTransactionOut.Show(); frmTransactionOut.BringToFront(); } else if (frmTransactionOut.IsDisposed == true) { frmTransactionOut = new frmTransactionOut(); frmTransactionOut.MdiParent = this; frmTransactionOut.Show(); frmTransactionOut.BringToFront(); } else { frmTransactionOut.Activate(); frmTransactionOut.Show(); frmTransactionOut.BringToFront(); } break; case "frmPartyMaster": if (frmPartyMaster == null) { frmPartyMaster = new frmPartyMaster(); frmPartyMaster.MdiParent = this; frmPartyMaster.Show(); frmPartyMaster.BringToFront(); } else if (frmPartyMaster.IsDisposed == true) { frmPartyMaster = new frmPartyMaster(); frmPartyMaster.MdiParent = this; frmPartyMaster.Show(); frmPartyMaster.BringToFront(); } else { frmPartyMaster.Activate(); frmPartyMaster.Show(); frmPartyMaster.BringToFront(); } break; case "frmInventory": if (frmInventory == null) { frmInventory = new frmInventory(); frmInventory.MdiParent = this; frmInventory.Show(); frmInventory.BringToFront(); } else if (frmInventory.IsDisposed == true) { frmInventory = new frmInventory(); frmInventory.MdiParent = this; frmInventory.Show(); frmInventory.BringToFront(); } else { frmInventory.Activate(); frmInventory.Show(); frmInventory.BringToFront(); } break; case "frmUnitMaster": if (frmUnitMaster == null) { frmUnitMaster = new frmUnitMaster(); frmUnitMaster.MdiParent = this; frmUnitMaster.Show(); frmUnitMaster.BringToFront(); } else if (frmUnitMaster.IsDisposed == true) { frmUnitMaster = new frmUnitMaster(); frmUnitMaster.MdiParent = this; frmUnitMaster.Show(); frmUnitMaster.BringToFront(); } else { frmUnitMaster.Activate(); frmUnitMaster.Show(); frmUnitMaster.BringToFront(); } break; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }