Files in an application?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can my executable determine the classes (specifically User Controls) in
itself? My program needs to know the list of User Controls that are in it.
 
Dave said:
How can my executable determine the classes (specifically User Controls)
in
itself? My program needs to know the list of User Controls that are in it.

'[Assembly].GetExecutingAssembly.GetTypes' will return an array of types
defined in the assembly. Then you can check each 'Type' object's 'BaseType'
property and compare it to the 'UserControl' type.
 
That's what I need, except I want to use the info to instantiate my User
Control. I want to put your suggested code in a function and return the User
Control back to the calling routine. This function returns Types, and I can't
seem to convert the Type returned to a User Control.

Any ideas how to do that?
Thanks for all your help.

Herfried K. Wagner said:
Dave said:
How can my executable determine the classes (specifically User Controls)
in
itself? My program needs to know the list of User Controls that are in it.

'[Assembly].GetExecutingAssembly.GetTypes' will return an array of types
defined in the assembly. Then you can check each 'Type' object's 'BaseType'
property and compare it to the 'UserControl' type.
 
Back
Top