How to get treeview node child count
TreeView1.Nodes.Count
that gets all the nodes count, trying to get just the child node count for a particular parent node, preferably without looping through but whatever.
TreeView1.Nodes(0).Nodes.Count
doesn't work, the ending isn't supported, using vb6 and the latest version of treeview(sp6).
Re: How to get treeview node child count
objTreeView.Children Code:
returns the number of childnodes.
Re: How to get treeview node child count
Try:
TreeView1.Nodes(0).Children.Count
Just as described in the manual.
Re: How to get treeview node child count
I just want everyone to know this stupid control is extremely dangerous the follow code locked up my system, it rebooted, then blue screened on load. DO NOT RUN THIS
Quote:
Private Function FindStartEnd(TreeView As TreeView, iStart As Long) As Long
Dim total As Long
Dim i As Long
total = TreeView.Nodes.Count - iStart
For i = iStart To total
If TreeView.Nodes(i).Parent Is Nothing Then
FindSubStartEnd = i
Exit For
End If
Next i
End Function
the point of this code is to find the last child node entry for a parent node group since I won't know where the parent nodes are anyway without looping. The problem is I called it with iStart set as 0 and thats when all the crazyness went down, was running inside the ide too.