TreeView Question

TarBall

Registered User.
Local time
Today, 12:35
Joined
Jul 25, 2005
Messages
11
I have a tree view that depicts Test Case Area (Parent Node) and the associated Test Cases (Children). I have checkboxes property set to TRUE. In the NodeCheck method, I want to say "If the parent Node is checked, then check all of its children".

2 Questions

1-How do I iterate through the children of the selected node?
2-How do I handle the situation when a parent nodes state goes from checked to unchecked such that all of its associated children get unchecked too?


Thanks for the help.

Chris

PS- I searched the forum for related questions - found some cool tips and tricks with the TreeViews but nothing that had TreeViews with checkboxes.
 
Worked the solution out myself. Here it is for those who are interested.

Code:
Private Sub xTree_NodeCheck(ByVal Node As Object)

Dim nChild As MSComctlLib.Node, intI As Integer
Dim objTree As TreeView

Set nChild = Node.Child
  For intI = 1 To Node.Children
     If Node.Checked = True Then
        nChild.Checked = True
     Else
        nChild.Checked = False
     End If
  Set nChild = nChild.Next
  Next intI

End Sub
 

Users who are viewing this thread

Back
Top Bottom