Click here to Skip to main content
16,021,041 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi frds,
I want to enable and disable the mdiparent menustrip. Inside the mdiparent form no mdi child form is open means the menustrip is in enable stage. Suppose anyone child form is in open means the menustrip in disable stage. How can I do this.
Anyone reply me as soon as possible.
Thanks
Posted

MenuStrip class has a Enabled[^] property, inherited from Control class, which is exactly what you need.
 
Share this answer
 
v2
Comments
Mekalamani 27-Oct-15 7:39am    
please say somewhat briefly
phil.o 27-Oct-15 7:41am    
Somewhat briefly
Make your menustrip modifier to "Public" and use below code in child form to disable menustrip.

C#
Form1 parent = (Form1)this.MdiParent;
//parent.menuStrip1.Visible = false;
parent.menuStrip1.Enabled= false;



Thanks
 
Share this answer
 
v2
Comments
Mekalamani 27-Oct-15 7:47am    
Thank You so much, I got answer
In Form_load event of the child, disable menu or better yet, fire custom event ChildOpened. In FormClosed event, fire another event ChildClosed that will be caught in the parent form.

You can avoid first one by disabling the menu when you instantiate child form, but before opening it.

Based on MdiChildren collection you can then enable/disable menu with
C#
menu.Enabled = (this.MdiChildren.Count == 0);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900