iterate over all the forms in a project
C#
4
Posts
3
Posters
0
Views
1
Watching
-
hii 4 all How can i iterate over all the forms in my project? it is not mdi application i have tried application.openforms its not working!
-
If you create a new form, put it in a collection. For example : List
forms = new List(); Form form1 = new Form(); forms.Add(form1); You can iterate it in this collection.
-
but , i want to get all of the forms in the project without creating object first, i tried foreach (Form frm in Application.OpenForms) but it just returns the opend forms only! :confused:
When you say "get all of the forms in the project" do you mean all the forms in a Visual Studio project, or all of the forms in a running application? The latter will require using reflection.
only two letters away from being an asset