Q: Collection Classes

G

Guest

Morning group,

I am relatively new to VB.NET programming and have a question that I hope
this group can help me with.

I am putting together a VB.NET component that will be accessed through
collections and objects, like the VB6 treeview and/or listview. The
component will be created as a COM class and exposed to VB6.

With VB6, we add nodes to the treeview with the following code:
Dim nodEnter as Node

Set nodEnter = Treeview1.Nodes.Add (...)

If I am wanting to program similar functions in VB.NET, how exactly would
this work? I current have my object and collection objects ... let's call
them Widget (object) and Widgets (collection). The Add method is part of the
collection. What do I need in the object class so that in VB6, I can include
the following:
Dim wid as Widget

Set wid = Widgets.Add (...)

Thanks for any assistance you can offer.
Richard
 
P

Patrick Steele

Morning group,

I am relatively new to VB.NET programming and have a question that I hope
this group can help me with.

I am putting together a VB.NET component that will be accessed through
collections and objects, like the VB6 treeview and/or listview. The
component will be created as a COM class and exposed to VB6.

With VB6, we add nodes to the treeview with the following code:
Dim nodEnter as Node

Set nodEnter = Treeview1.Nodes.Add (...)

If I am wanting to program similar functions in VB.NET, how exactly would
this work? I current have my object and collection objects ... let's call
them Widget (object) and Widgets (collection). The Add method is part of the
collection. What do I need in the object class so that in VB6, I can include
the following:
Dim wid as Widget

Set wid = Widgets.Add (...)

Exposing an object for COM interop is not a trivial thing. It takes a
bit of upfront planning in terms of interfaces and attributes. I've
written a couple of articles on COM interop that should answer many of
your questions. See:

http://www.15seconds.com/issue/040721.htm
http://www.15seconds.com/issue/060309.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top