|
-
Oct 15th, 2011, 04:41 AM
#1
Thread Starter
Lively Member
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).
-
Oct 15th, 2011, 05:13 AM
#2
Junior Member
Re: How to get treeview node child count
objTreeView.Children Code:
returns the number of childnodes.
Look busy. Jesus is coming.
-
Oct 15th, 2011, 05:56 AM
#3
Re: How to get treeview node child count
Try:
TreeView1.Nodes(0).Children.Count
Just as described in the manual.
-
Oct 15th, 2011, 06:05 AM
#4
Thread Starter
Lively Member
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
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|