Click here to Skip to main content
15,898,373 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Friends,

If i open the MDIChild form then the menu will be disable. after i close the MDIChild form the menu should be enable for open again.

Please help me
Posted
Comments
Manfred Rudolf Bihy 15-May-12 10:19am    
And what exactly seems to be the problem? This should not be too difficult to accomplish even for a beginner. Please edit your question and add a little more input. Like what you have tried and where you are stuck!

Thanks for your cooperation!
Sandeep Mewara 16-May-12 1:50am    
Reply from OP;
i have mdi form and some child form
i want to have one instance of these child forms and when i close one of them
i can open it again.
thanks

If you would like to disable/enable menu, read this[^] article on msdn site. There you'll find an answer.

How to achieve this? Inside Menu_OnClick method:
1) Disable your menu
2) Show second form
Inside Form_Closing (Form2) event
1) Enable your menu
 
Share this answer
 
Comments
Sandeep Mewara 16-May-12 1:50am    
Comment form OP:
my freind i did and check it with break point but does not work then asked on code project

i have a mdi form and it has some child
when my user click one of menu an instance of child form create and shows
on Form1 (Mdi Form) i used a public int variable
and when my user clicks on menu for first time and
if variable==0 item menu disabled and an instance of child form create and shows
and variable++
on the child form closing i set the variable to 0 and menu enabled.
i think Form_closing()on child form does not work.
please help me.
Yes its simple,
follow these steps:
> You first need to create a static object of the main form or mdi form in your program class.

> When you start program from Splash screen, show this static main form intializing its object.

> now create menus in this mdi form to show child form making it parent.
Now here comes the main part...
on form closing event of child form disable the menu of the mdi form. Here you will not create any object, just refer to the static object you created in Program class.



for a smiliar example you can also refer
Creating MDI application using C# (Walkthrough)[^]

I hope this helps you.

- Kshitiz Chandra
www.kshitizchandra.com
 
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