adding user-controls at runtime COMPLETE dynamic (plug-in mechanism)

Mimo
01-21-2004, 01:43 PM
Hallo!

At first I have to say that I'm happe to find a big VB.net community like this here! I think I can leran here a lot! And I hope after a while I can support this forum here also with my knowledge. But at first now I have to read and to learn much! :)

My problem:

You know "Form1.Controls.Add" from VB6? I'm looking for something semilar to this in VB.net.

I want to write a plug-in mechanism for a Windows-Application. No web, no XML.

I have written user-controls in VB.net. For example I have a dll called MyDll and there are two user-controls inside: MyControl1 and MyControl2.

Now a have to write an net-application where I look into a configuration-file which controls I have to load at runtime. That means I have no reference at design-time to this usercontrol.

How have I to do that? :confused: I have found a couple of examples but there are only loading controls like standard Textboxes or Labels.

For every hint I would be lucky.

Greetings,
Mimo

- - - edit - - -
Probably I found a solution (in C#):
http://www.codeproject.com/csharp/ExtensibleUI.asp

But unfortunately I didn't get it in VB. CreateInstance always returns Nothing. :(

Mimo
01-22-2004, 04:58 AM
Hi guys!

I have it now! :)

The problem was: The library with the usercontrol/dll I have taken for doing the tests was downloaded from the internet. I used that usercontrol in my application and it works fine.

But not creating it at runtime!

But yesterday night I took an "Assembly Viewer" to have a look inside the assembly. And the viewer told me "there is something wrong!". :huh:

So I took another usercontrol/dll and it works fine.

I used the c#-code described in the link above.

*puh*

Greetings,
Mimo

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum