Click here to Skip to main content
15,906,645 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello All,

I have created an MDI.In that MDI i am using several child forms .I have implemented a logout menu item.I want all child forms close when i am clicking logout menu item.Is there any way to loop through all forms in MDI.Plese Help.

Regards,
Sham
Posted

 
Share this answer
 
Use the Form.MdiChildren property[^]:
Form[] children = MdiChildren;
foreach (Form f in children)
   {
   f.Close();
   }
 
Share this answer
 
Comments
shameen.cp 28-Jun-11 3:34am    
Thanks Griff...your solution is 100% correct...
OriginalGriff 28-Jun-11 3:46am    
You're welcome!

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