Results 1 to 2 of 2

Thread: [RESOLVED] Treeview - How to get list of child nodes for a node

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Posts
    103

    Resolved [RESOLVED] Treeview - How to get list of child nodes for a node

    Hi,

    I think this is a pretty easy question, but I can't seem to find the answer in my search.

    Let's say I have a treeview called treeview1. It's got three main nodes: BigNode1, BigNode2, and BigNode3. Each has some child nodes, like this:

    Code:
    BigNode1
       LittleNode1
       LittleNode2
       LittleNode3
    BigNode2
       LittleNode4
       LittleNode5
       LittleNode6
    BigNode3
       LittleNode7
       LittleNode8
       LittleNode9
    How do I get a list of the child nodes for one of the big nodes?

    Thanks in advance.
    -Bret

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Posts
    103

    Re: Treeview - How to get list of child nodes for a node

    Nevermind. I found it. Here's what I used:

    Code:
    Private Sub TreeView1_NodeCheck(ByVal Node As MSComctlLib.Node)
       CheckUncheckNodes Node, Node.Checked
    End Sub
    
    Private Sub CheckUncheckNodes(ByRef MyParentNode As Node, ByVal bChecked As Boolean)
    Dim MyNode As Node
    
     Set MyNode = MyParentNode.Child
     Do While Not MyNode Is Nothing
       MyNode.Checked = bChecked
       CheckUncheckNodes MyNode, bChecked
       Set MyNode = MyNode.Next
     Loop
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width