Hi List,

I'm trying to write an Add-In that will put controls on a Windows Form in a
VB.Net application. Looking at the WinFormsAutomation sample application
that comes with .NET the code for creating a command button is this:

        Btn =
host.CreateComponent(host.GetType("System.Windows.Forms.Button,System.Windo
ws.Forms"))

I need to get a pre-compiled UserControl class on the form. The class is
compiled into an assembly, which is is referenced in the Add-in and target
projects. In the target project I have added the control to the toolbox so
I can drag it onto the form from there. This is all working fine, but I
can't work out how to make the add-in create an instance of the control.
The control is SCAT.SCATField, so I tried using a format analogous to the
button, like this:

        SF = host.CreateComponent(host.GetType("SCAT.SCATField,SCAT"))

Unfortunately this fails with a Null Reference exception. I can think of
nowhere else to go from here. Any ideas?

Regards,

Jay Ayliff
Stalis Ltd

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to