Iterate TreeView

S

Sandro

Does anyone know how to iterate through a TreeView node by node?

Thanks in advance
 
L

lisa

Sandro said:
Does anyone know how to iterate through a TreeView node by node?

Call TreeViewRecurse(MyTreeView.Nodes)

Sub TreeViewRecurse(ByVal nodes As TreeNodeCollection)
For Each myNode As TreeNode In nodes
' -----
' Do something here
' -----
If myNode.HasChildren Then
Call TreeViewRecurse(myNode.Nodes)
End If
Next myNode
End Sub

HTH,
Lisa
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,142
Messages
2,570,820
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top