
Create Active X Object at runtime
Hi,
I was astounded to find out that I couldn't make it work too.
However, what does work, although you may not want it that way, is to
put a TreeView control on your form in advance and set the Index property to
0
suggesting it to be an element in a control array. Now you may create new
instances
in your code of the control array with Load. E.g. if your treeview control
is called tvList(0), add another treeview with 'Load tvList(1)'. You can use
any index you want though. Of course, when no longer needed use Unload to
get rid of it again.
Don't forget to position the newly created control and make it visible.
If somebody knows a better way or to do it properly, don't hesitate to
reply. I'd like to know too.
Marc de Hoogh
Quote:
> Hi!
> How can i create an instance of an ActiveX-Object (Treeview) at runtime?
> I tried with 'Dim x As TreeView' but i always get an exception when i
> try to read or write to this Object or to call a method (x.Nodes.Add).
> I tried also with 'Dim x As New TreeView', but it didn't work.
> I hope some1 can help me.
> Ciao
> Marco
> --
> +++
> (o o)
> -----------ooO--(_)--Ooo-----------