All opened forms

Does anybody know how to get all opened forms that exist in program? (Background: I would like to close all forms (all but main) that are opened after the timer on main form runs out.)
If you have MDIContainter it is simple:  foreach (Form frm in this.MdiChildren) and you get them. I would like to do something similar with non MDI form if it's possible.

Thank you!
ssdjgru1Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
What version of .NET do you have?

Bob
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
If you have C# 2005 then use the Application.OpenForms collection :
http://msdn2.microsoft.com/en-us/library/system.windows.forms.application.openforms(VS.80).aspx

If you don't have an MDI app then you have to track all open forms manually by keeping references to them in a list such as the ArrayList.  Subscribe to the forms closing event so you can remove it from your list when the form is closed...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bob LearnedCommented:
Hi, Mikey :)

Bob
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
G'Morning Bob!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.