Traverse Node in TreeView Control

  • Thread starter Thread starter Shaurya Vardhan
  • Start date Start date
S

Shaurya Vardhan

Hi,

How to Traverse all the nodes of a Tree View Control using VB.Net?

Thanx in Advance.
 
* "Shaurya Vardhan said:
How to Traverse all the nodes of a Tree View Control using VB.Net?

\\\
RecurseNodes(Me.TreeView1.Nodes)
..
..
..

Private Function RecurseNodes(ByVal Node As TreeNodeCollection)
For Each tn As TreeNode In Node
MsgBox(tn.Text)
RecurseNodes(tn.Nodes)
Next tn
End Function
///
 
Errata:
Private Function RecurseNodes(ByVal Node As TreeNodeCollection)
For Each tn As TreeNode In Node
MsgBox(tn.Text)
RecurseNodes(tn.Nodes)
Next tn
End Function

.... should be a 'Sub', not a 'Function'.
 
Back
Top