Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:

So I posted a question the other day about dynamically loading DLL components. And it works great if I know the type like this(whatever.whatever):

C#
Assembly asm = Assembly.LoadFrom(openFileDialog1.FileName);
Type myType = asm.GetType("whatever.whatever");
UserControl uc = (UserControl)Activator.CreateInstance(myType);
uc.Name = "uc";
this.Controls.Add(uc); 

But now how would I do this without knowing the type before?

Thanks :)

Posted
Updated 25-Aug-09 11:15am
v3

1 solution

roguemat wrote:
But now how would I do this without knowing the type before?


asm.GetTypes()[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900