Click here to Skip to main content
15,902,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello i am creating a small MDI project in c# gui my problem is that whenever i click on the student menu strip a new instance of the student form is created,everytime i do this a new instance of the student form is created is their any method which will first close all the activated MDI in the parent form and then open the student form,
i am creating the instance of the student form at runtime with the help of the following code which i have wrote at the student menu strip
frmstudent studform = new frmstudent();
studform.MdiParent = this;
studform.Show();

please reply early i need this for my assignment...
Thank u :-\
Radix
Posted

radix3 wrote:
is their any method which will first close all the activated MDI in the parent form


No - you have to write it yourself - but it will look like this:
foreach (Form f in MdiChildren)
   {
   f.Close();
   }


Then do your existing code, and you are there.
 
Share this answer
 
Thank u OriginalGriff that really helpd me a lot Thank u very much...

Thanks & Regards
Radix
 
Share this answer
 
v3

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