
Dynamically add ActiveX control to VB.NET Form
Hi Ewart,
Not sure if I'm on the right track and if this of any help. But what I
do is to reference the particular ActiveX control in my project by
adding it to the toolbox which is available when displaying a form in
the designer in the .net IDE. Subsequently I create an instance of the
activeX control just as I would in VB6 by adding it to the form:
' only got IDispatch here
MyActiveXobj = New AxMyCtrlObjLib.AxMyCtrlObj()
' ActiveX obj must connect to the container's interfaces when
' put on the container. Otherwise it doesn't know where it is
Me.Controls.Add(MyActiveXobj)
' do something with the control
MyActiveXobj.left = 0
MyActiveXobj.top = 42
MyActiveXobj.DoIt
I think this should instantiate your ActiveX control properly.
HTH,
Rob
Quote:
> Thanks Bob, I looked at that but unfortuantely that article does not truly
> describe how to DYNAMICALLY load controls. I need to load it dynamically
> rather than creating a reference at design time - the control will not exist
> at design time.
> anyone got any ideas? seems Microsoft have {*filter*}ed up this part of the
> design for .net
> rgds,
> ewart.