Click here to Skip to main content
15,908,841 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi everybody !
how can i count child nodes in a selected root node ?
Posted

You can use

1.Count including the sub nodes

treeView1.SelectedNode.GetNodeCount(true )


2.Count exluding the sub nodes

treeView1.SelectedNode.GetNodeCount(false )
 
Share this answer
 
Comments
Amir Mahfoozi 31-Oct-11 9:09am    
+5
Bala Selvanayagam 31-Oct-11 9:18am    
thanks amir
If you just want the bare number then Nodes.Count will give it directly.
If you need to total all the sub nodes as well, then it is a simple recursion on each node.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900