Create Active X Object at runtime 
Author Message
 Create Active X Object at runtime

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-----------




Mon, 26 Nov 2001 03:00:00 GMT  
 Create Active X Object at runtime
VB6 introduced Dynamic Control Creation; please look it up in the docs.
It's the closest we can get to control creation facilities in languages such
as C, Delphi, Java.


Mon, 26 Nov 2001 03:00:00 GMT  
 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-----------





Tue, 27 Nov 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Active Report - Create Subforms at runtime

2. Active reports - create subforms at runtime

3. Active-X component cannot create the object

4. Active X component can't create object

5. How do I solve Active X component can't create object error

6. Run Time Error 429: Active-X component can't create object

7. Active X Component can't create Object

8. Active X component can't create object.

9. Active X Executable can't create object in Windows 2000

10. Active X Component Can't Create Object !

11. Active X unable to create object?

12. Active X component can't create object

 

 
Powered by phpBB® Forum Software