Re: Treeview help




<Fern G> wrote in message news:e$bxhVPCGHA.1312@xxxxxxxxxxxxxxxxxxxxxxx
> Mike, thank you,
>
> there is a lot to absorb in what you posted. Can I just ask you something
> quickly before I read your post? In vb.net it's possible to get a nodes
> collection from a node like this
>
> nodes= node.nodes
>
> Is this possible also in VB6.

No. In VB6's Treeview, there's only one Nodes collection, a reference to
which is obtained from the Nodes property of the Treeview control itself. In
VB.NET, each TreeNode object has its own TreeNodeCollection. I supposed you
could write a wrapper class for VB6's Treeview to provide this
functionality, though.

>
> The problem as I see it is that initially I have the root collection, i.e.
> treeview1.
> Then, I need to add by key reference a new root node, and then obtain that
> node's collection, and so on. Is this the correct approad?

No. As I said, there's only *one* Nodes collection. It includes ALL Node
objects for the entire Treeview control. There are several properties for
getting references to related Node objects. Look up the Child, FirstSibling,
LastSibling, Next, Previous, Parent, and Root properties of a Node object.
All of these return a reference to some other Node object.

It sounds like you're coming from a VB.NET background. You need to quit
thinking in VB.NET terms when working in VB6. <g>


> o.k. now I am going to read your post

You probably should have read it and tried the sample code first. It might
have answered your questions.

--
Mike
Microsoft MVP Visual Basic


.



Relevant Pages

  • Re: TreeView Control
    ... Have you looked into the NodeClick event and the Node object that's passed? ... Play around with that and it should provide the functionality you are ... > same form the Treeview Control is on. ...
    (microsoft.public.vb.controls)
  • Re: Treeview help
    ... the first argument is a reference to the parent. ... I didn't know you could pass a reference to a Node object for the first ... What matters most is writing clear and concise code. ...
    (microsoft.public.vb.general.discussion)
  • Re: Treeview help
    ... the first argument is a reference to the parent. ... I wonder.....would a reference to a Node object ... > think passing a Node object is a good idea. ... I can't see the control determining that it has the reference ...
    (microsoft.public.vb.general.discussion)
  • Re: the garbage collector
    ... Skybuck Flying wrote: ... Linked lists are still possible. ... Each node object would hold a reference ...
    (alt.comp.lang.borland-delphi)
  • Re: the garbage collector
    ... > Linked lists are still possible. ... Each node object would hold a reference ... If the garbage collector at some point decides ...
    (alt.comp.lang.borland-delphi)