Click here to Skip to main content
15,899,126 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
How do I get a list of all the forms in C#.
Meaning...
- openforms
- hide forms
- invisible forms

Please help me!
Posted
Updated 25-Aug-10 8:04am
v3
Comments
Dalek Dave 25-Aug-10 9:47am    
Minor Edit
Simon_Whale 25-Aug-10 10:12am    
apart from looking at the solutions explorer on the left hand side of visual studio. Im not sure of what your trying to do. some more information will help you get a thorough answer
Toli Cuturicu 25-Aug-10 13:02pm    
Reason for my vote of 1
duplicate post
BillW33 26-Aug-10 14:52pm    
Reason for my vote of 3
Although the question could have been worded better it is a generally useful tecnique.

You do not say which version of C# or .NET you are using. Also, you do not say if you are using WPF or not.

In .NET Framework 2.0 and later, in the System.Windows.Forms namespace, there is the OpenForms property which returns a FormsCollection.

You can also use Application.OpenForms. For example:

C#
foreach (Form form in Application.OpenForms)
{
    //do something with the forms
}
 
Share this answer
 
v2
Comments
amitthakkar1987 25-Aug-10 10:45am    
i m using .net 3.5 and use window application
Application.OpenForms will give you all forms currently open, regardless of their visible or enabled state.
 
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