Finding name of all forms

  • Thread starter Thread starter Tor Inge Rislaa
  • Start date Start date
T

Tor Inge Rislaa

Finding name of all forms

I want to create a procedure that can loop trough all objects of type form
in an application and print the name property to the debug window.

TIRislaa
 
Tor Inge Rislaa said:
I want to create a procedure that can loop trough all objects of type form
in an application and print the name property to the debug window.

You'll have to write and maintain your own forms collection.
 
What book are you talking about?
"Supra" <[email protected]> skrev i melding he should have reread book again

Herfried K. Wagner [MVP] wrote:

I want to create a procedure that can loop trough all objects of type form
in an application and print the name property to the debug window.

You'll have to write and maintain your own forms collection.
 
Tor Inge Rislaa said:
Finding name of all forms

I want to create a procedure that can loop trough all objects of type form
in an application and print the name property to the debug window.

Try this:

Dim item As Type
For Each item In System.Reflection.Assembly.GetExecutingAssembly.GetTypes
If GetType(Form).IsAssignableFrom(item) Then
Debug.WriteLine(item.Name)
End If
Next

LFS
 
Larry Serflaten said:
Try this:

Dim item As Type
For Each item In System.Reflection.Assembly.GetExecutingAssembly.GetTypes
If GetType(Form).IsAssignableFrom(item) Then
Debug.WriteLine(item.Name)
End If
Next

Oh, I thought about all form /instances/ ;-).
 
Herfried,

As always you answered directly on the question from the OP, however
probably the answer as Larry did it is the right answer for the problem.
However that is not 100% sure because Tor is asking for Objects and not for
types/classes.

:-)

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top