How to get all forms in a Project

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

Hi,
Is there any way to find out all the forms in a project at run time.

Thanks for any help you can provide.

Thanks, Rob
 
Rob said:
Hi,
Is there any way to find out all the forms in a project at run time.

Thanks for any help you can provide.


In general, I always wonder why a programmer wants to _find out_ which
classes he wrote on his own.

In other words, why write code that will be executed later in order to
determine what is already known at this moment?

Though, you can reflect about your code. Surprisingly, this method is called
Reflection. Have a look here:
http://msdn2.microsoft.com/en-us/library/cxz4wk15(VS.90).aspx


What are you trying to accomplish?


Armin
 
I want to show all the forms in a project in a dropdowns.
I knew I could do it using reflection but do not have any example.
Can you please provide me an example.

Thanks, Rob.
 
Rob said:
I want to show all the forms in a project in a dropdowns.

Which information do you want to show? Neither a user is interested in class
names (usually), nor classes should be named in order to be user friendly.

You can easily create an array:

Dim FormTypes As Type() = {GetType(Form1), GetType(Form2), GetType(Form3)}

I knew I could do it using reflection but do not have any example.
Can you please provide me an example.

Have you seen my link? Look at the TOC and you will find the information
required. Probably the topic "Viewing type information" is what you are
looking for.


Armin
 
Rob,

I have always the same thinking about this kind of questions as Armin wrote,
I am glad that he wrote that it he has that too.

You know what forms there are, you can set them in a class, in an enum, in a
module, direct in your combobox or whatever. Why should that be done later,
in whatever way you do it, it will only in a negative way influencing the
performance of your solution (especially with reflection).

Cor
 
Armin,

Do you still use that method of sending messages in a batch?

I would not have send mine if I has seen this one of you before it.

Cor
 
Cor Ligthert said:
Armin,

Do you still use that method of sending messages in a batch?

I would not have send mine if I has seen this one of you before it.

I don't use any "method". Sent some minutes later. Accidently. Happens. Or
maybe I wrote other posts in the meantime? If I had to delete all my replies
to questions that have already been answered meanwhile, I would have to
discard a lot of my "work".


Armin
 
Back
Top