MDI
-
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
-
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
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;
-
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;
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
-
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