Enable/Disable MDI Parent menu from child form

TXProgrammer

New member
Joined
Jan 5, 2012
Messages
2
Programming Experience
10+
I'm writing an MDI app in vb.net vs2010. The MDI form has the default MDIMenustrip menu with several menu items. Each has some subitems. None of the child forms have a menustrip defined. I thought it would be easy to call a public subroutine in the MDI that would disable or enable the MDIMenustrip items. If I execute the routine from the MDI form, the menu items disable/enable just fine. THe problem I have is when I call the routine from a child form. How can I control the MDI menu from a child form?

Thanks in advance for your help!
 
You have two main options. If the parent form is the default instance of its type then you can access it anywhere, any time as the default instance. To learn more about default instances, follow the Blog link in my signature and check out my post on the subject. Note that the startup form for your app will be the default instance of its type.

The alternative and more professional way to do it is to have only the parent form make changes to itself. If the child forms want the parent for to do anything then they should raise an event to indicate it. The parent form handles the event(s) and then it makes its own changes.
 
I tried both methods and neither worked. As long as I call the menu updating routine from within the MDI Form, the menu options enable and disable correctly. When I use a child form to call a the routine in the MDIForm to either trigger an event or call a public routine, I can read the current state but cannot modify it. VB doesn't give me any errors; it just doesn't allow the updating of the enable/disable state. Is there a property of the Toolstrip that maybe I set that prevents modification?
 
Back
Top