Showing child menu instead of MDI Parent menu in vb.net
-
Hello, I think this might be very silly question, However Can anybody tell me How to show the Child menu when only child is opened. The Scenario is If i opened the MDIParent then only menu on MDIParent is visible but as soon as i opened any child form the respective forms menu will be used instead of MDIParent menu. On closing child once again MDIParent menu is visible. Regards, Datta
-
Hello, I think this might be very silly question, However Can anybody tell me How to show the Child menu when only child is opened. The Scenario is If i opened the MDIParent then only menu on MDIParent is visible but as soon as i opened any child form the respective forms menu will be used instead of MDIParent menu. On closing child once again MDIParent menu is visible. Regards, Datta
The only way I can think of doing this, is by creating a local variable on your child forms, which exposes your parent form in the child. i.e.
Private ParentForm as frmParent. You can pass this info through the constructor of your child form, and in the constructor set this variable like thisPublic Sub New(ByVal Parent As frmParent) ' This call is required by the Windows Form Designer. InitializeComponent() myParent = Parent ' Add any initialization after the InitializeComponent() call. End SubThen in your FormLoad event you can set the menustripitems.visible on the parent to false. like this
myParent.MenuStrip1.Items(0).Visible = False myParent.MenuStrip1.Items(1).Visible = FalseNot forgetting to set visible to true in your FromClosing Event. Hope this helps