By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,968 Members | 1,852 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,968 IT Pros & Developers. It's quick & easy.

Finding name of all forms

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
"Tor Inge Rislaa" <no*************@rislaa.no> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #2

P: n/a
he should have reread book again

Herfried K. Wagner [MVP] wrote:
"Tor Inge Rislaa" <no*************@rislaa.no> schrieb:

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.


Nov 21 '05 #3

P: n/a
What book are you talking about?
"Supra" <su*****@rogers.com> skrev i melding news:O8**************@TK2MSFTNGP10.phx.gbl...
he should have reread book again

Herfried K. Wagner [MVP] wrote:

"Tor Inge Rislaa" <no*************@rislaa.no> schrieb:
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.
Nov 21 '05 #4

P: n/a

"Tor Inge Rislaa" <no*************@rislaa.no> wrote
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.Ge tTypes
If GetType(Form).IsAssignableFrom(item) Then
Debug.WriteLine(item.Name)
End If
Next

LFS
Nov 21 '05 #5

P: n/a
"Larry Serflaten" <se*******@usinternet.com> schrieb:
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.Ge tTypes
If GetType(Form).IsAssignableFrom(item) Then
Debug.WriteLine(item.Name)
End If
Next


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

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #6

P: n/a
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

"Herfried K. Wagner [MVP]" <hi***************@gmx.at>
"Larry Serflaten" <se*******@usinternet.com> schrieb:
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.Ge tTypes
If GetType(Form).IsAssignableFrom(item) Then
Debug.WriteLine(item.Name)
End If
Next


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

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.