Dot Net FormsCollection in 1.1 or 2.0

Merchand

Well-known member
Joined
Dec 28, 2005
Messages
73
Location
USA Eastcoast
Programming Experience
10+
I know there is not a FormsCollection in VS2003. I'm wanting to create a method to return an ArrayList of all the loaded WinForms in a running Application. I know M$ says you can create your own collection or load OwnedForm collection using AddOwnedForm method.

However, I'm looking at creating a method that knows not a thing about an applicaition. I can list all of the running processes using the Process Namespace. I can't find anything showing how to list the actively loaded forms of an application.

Does anyone know how to get the loaded forms of a running application using Process, Reflections or anyother namespace?

Or, do I have to revert to a Windows API? If so does anyone know which APIs will help me out?

Thanks!!! :D
 
Hey, all I have just found this new class in FW2.0 called FormCollection and it probably will take care of my question as it relates to VS2005 but I am still interested in how to get the loaded forms in VS2003/FW1.1. (API?)

I have been looking but can't find anything. If I create a .dll (Class library) based on FW2.0 and install the FW2.0 and .dll on target workstations, how can I get a project developed in VS2003 to see the FW2.0 .dll assembly? Assuming both Fw1.1 and Fw2.0 are on same machine.

Answers to both questions would be greatly appreciated!!!
 
This new FormCollection can be used as follows...

Dim value As FormCollection
value = Application.OpenForms

The collection is readonly. [???]
 
Merchand said:
The collection is readonly.
Of course it is. It is supposed to give you a list of all open forms, so it's not appropriate to be able to add to or remove from it. You open a form or close one and the change is reflected in the collection.
 
Back
Top