How to get a list of available types

  • Thread starter Thread starter news://news.microsoft.com
  • Start date Start date
N

news://news.microsoft.com

Hello,

i have a property of type "System.Type" which i want to make editable with
the default PropertyGrid. The user should not only enter the name of the
type, but choose one type form a list.
For that reason i must (as i know) inherit from the abstract class
System.ComponentModel.TypeListConverter.
In that class i have to create a Sub New and provide the constructor of
System.ComponentModel.TypeListConverter with a list of Types.

How can i find out the available types of the app where my control is used ?


Walter
 
Hi

This is quite simple using reflection:
System.Reflection.Assembly a =
System.Reflection.Assembly.GetEntryAssembly();

foreach(Type t in a.GetTypes())
{
MessageBox.Show(t.Name);
}

Jan
 
Yes, this works fine .... at Runtime

but i have to know the availabe Types at Designtime. At Designtime
"System.Reflection.Assembly.GetEntryAssembly()" returns Nothing.
In my classlibrary i have a control with a public Property of Type 'Type'.
When a user uses this control in his application he should be able to set
this Property with the Designer to a class which he have created in his
application.

Kind Regards
 
Back
Top