|
-
Dec 3rd, 2006, 09:19 PM
#1
Thread Starter
Stuck in the 80s
[RESOLVED] Looping all open forms
How can I loop all open forms in a C# application?
Say I instantiate various new forms, how can I loop all these forms to look at their caption/text?
I feel like I'm explaining this horribly, but if anyone can help...
-
Dec 4th, 2006, 03:40 AM
#2
Re: Looping all open forms
I think VB provides a forms collection for the benefit of classic VB programmers, but I don't believe C# does that.
As far as I know, you would have to have some sort of a collection (e.g. List<Form>) and add forms to it as you instantiate them, then loop through that.
Alternatively, you could make a "CountedForm" class or something that inherits from Form and manages the collection for you; and make your form classes inherit from that instead, so that you don't have to write management code as you instantiate them.
-
Dec 4th, 2006, 10:30 AM
#3
Thread Starter
Stuck in the 80s
Re: Looping all open forms
Alright. I was hoping there was something similiar to VB6.
No problem doing it myself, I was just looking for an easy button.
Thanks for your help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|