Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. MDI

MDI

Scheduled Pinned Locked Moved C#
helpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    benjamin yap
    wrote on last edited by
    #1

    Hi, i have a main form (FrmMain.cs) that have a MenuStrip with File | Staff | Catalogue | Inventory | Order | Help| I have a child form (FrmLogin) to show the login page. Inside form_load of FrmMain.cs, I have the following code to hide | Staff | Catalogue | Inventory | Order | and only show them after they login. private void FrmMain_Load(object sender, EventArgs e) { this.toolStripStaff.Visible = false; this.toolStripCatalogue.Visible = false; this.toolStripProduct.Visible = false; this.toolStripOrder.Visible = false; this.toolStripInventory.Visible = false; FrmLogin childLogin = new FrmLogin(); childLogin.MdiParent = this; childLogin.Show(); } So, when the user login from the childLogin, how do i set the FrmMain's menu to show those hidden menu again

    G 1 Reply Last reply
    0
    • B benjamin yap

      Hi, i have a main form (FrmMain.cs) that have a MenuStrip with File | Staff | Catalogue | Inventory | Order | Help| I have a child form (FrmLogin) to show the login page. Inside form_load of FrmMain.cs, I have the following code to hide | Staff | Catalogue | Inventory | Order | and only show them after they login. private void FrmMain_Load(object sender, EventArgs e) { this.toolStripStaff.Visible = false; this.toolStripCatalogue.Visible = false; this.toolStripProduct.Visible = false; this.toolStripOrder.Visible = false; this.toolStripInventory.Visible = false; FrmLogin childLogin = new FrmLogin(); childLogin.MdiParent = this; childLogin.Show(); } So, when the user login from the childLogin, how do i set the FrmMain's menu to show those hidden menu again

      G Offline
      G Offline
      greekius
      wrote on last edited by
      #2

      Get The parent form from MDIPArent property of child form, than nest it to a main form type class, then set visiblity to TRUE. FrmMain frmMain=this.MdiParent; frmMain.toolStripStaff.Visible = true; frmMain.toolStripCatalogue.Visible = true; frmMain.toolStripProduct.Visible = true; frmMain.toolStripOrder.Visible = true; frmMain.toolStripInventory.Visible = true;

      B 1 Reply Last reply
      0
      • G greekius

        Get The parent form from MDIPArent property of child form, than nest it to a main form type class, then set visiblity to TRUE. FrmMain frmMain=this.MdiParent; frmMain.toolStripStaff.Visible = true; frmMain.toolStripCatalogue.Visible = true; frmMain.toolStripProduct.Visible = true; frmMain.toolStripOrder.Visible = true; frmMain.toolStripInventory.Visible = true;

        B Offline
        B Offline
        benjamin yap
        wrote on last edited by
        #3

        hmm i got this error else if ((txtUsername.Text == username) && (txtPassword.Text == password)) { FrmMain frmMain = this.MdiParent; frmMain.toolStripStaff.Visible = true; this.Hide(); } Error 2 Cannot implicitly convert type 'System.Windows.Forms.Form' to 'EBMS.FrmMain'. An explicit conversion exists (are you missing a cast?) F:\Temasek_Poly\Year_2\CSAD\Assignment\EBMS\EBMS\FrmLogin.cs 33 35 EBMS

        N 1 Reply Last reply
        0
        • B benjamin yap

          hmm i got this error else if ((txtUsername.Text == username) && (txtPassword.Text == password)) { FrmMain frmMain = this.MdiParent; frmMain.toolStripStaff.Visible = true; this.Hide(); } Error 2 Cannot implicitly convert type 'System.Windows.Forms.Form' to 'EBMS.FrmMain'. An explicit conversion exists (are you missing a cast?) F:\Temasek_Poly\Year_2\CSAD\Assignment\EBMS\EBMS\FrmLogin.cs 33 35 EBMS

          N Offline
          N Offline
          natsuyaki
          wrote on last edited by
          #4

          FrmMain frmMain = this.MdiParent as FrmMain;

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups