Samuel R. Neff wrote:
TreeViewEventArgs has a Node (singular) property that is the node that
was clicked. If you iterate it's children as in
for each nod as TreeNode in e.Node.Nodes
...
next
Then it will iterate the child of that node--direct children only and
not grandchildren.
If the tree has just two levels, clicking on the one root node will
make it appear that all nodes are iterated in the event handler.
Really you still need the recursive loop to get all desendent nodes.
HTH,
Sam
Yes, I meant AfterCheck.
1 problem. Mine is iterating everything. I tested at least 5 levels down
and it works. Are you sure that it won't iterate grand-children? Because
my testing shows that it goes down to at least the
great-great-great-grandchild. ?????
The code i used is this:
Private Sub TreeView1_AfterCheck(ByVal sender As Object, ByVal e as
System.Windows.Forms.TreeViewEventArgs)
Dim Child as TreeNode = Nothing
For Each Child In e.Node.Nodes
If e.Node.Checked = True Then
Child.Checked = True
Else
Child.Checked = False
End If
Next
End Sub
--
I'll have a B please Bob.