Link to home
Start Free TrialLog in
Avatar of RoninThe
RoninThe

asked on

Close all the child forms of a form

Hello experts,

I am creating several child forms from a main-form in my code. And then there is a sign-in/ sign-out logic. I want all my child forms to be closed at the time of sign-out, while keeping the main-from open for another log-in session.

how do I accomplish this. This is a winform application in C#.

thanks

ASKER CERTIFIED SOLUTION
Avatar of philoware
philoware

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of philoware
philoware

//***And also you can call this if you're in parentForm's class
foreach(Form form in this.OwnedForms)
{
      form.Close();
}