|
-
December 20th, 2008, 01:27 AM
#1
count number of nodes
i want to count to number of nodes under each root node so i m doing so
Code:
Dim n As Integer
For Each RootNode As TreeNode In treeAlbum.Nodes
n = RootNode.Nodes.Count
Next
MessageBox.Show("nodes " & n)
it is counting number of nodes but not exact,some time it is showing more nodes and some time it is showing less time.
plz help me
------------------------------------------------
-
December 20th, 2008, 01:52 AM
#2
Re: count number of nodes
Show more code. Is that a click event?
-
December 21st, 2008, 01:02 AM
#3
Re: count number of nodes
it is not click event
it is after select event of tree view
-
December 21st, 2008, 01:06 AM
#4
Re: count number of nodes
You are ASSIGNING the value...NOT accumulating it!
What is being returned is the number of nodes in the last item scanned.
You need a recursive (yes I know it can be flattened!) way to count the nodes...
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
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
|