DotNet Academy of Rajesh Rolen

Solutions by Rajesh Rolen

Visit all Nodes of TreeView

when we need to traverse all nodes of a treeview then we will have to create a recursive function.
In below example we are showing how to visit all nodes of treeview.
eg:-

Private Sub TraverseTreeView(ByVal tview As TreeView)
Dim temp As New TreeNode
For k As Integer = 0 To tview.Nodes.Count - 1
temp = tview.Nodes(k)
messagebox.show(temp) 'this will show node text
For i As Integer = 0 To temp.Nodes.Count - 1
visitChildNodes(temp.Nodes(i))
Next
Next
End Sub

Private Sub visitChildNodes(ByVal node As TreeNode)

messagebox.show(node) 'this will show node text
For j As Integer = 0 To node.Nodes.Count - 1
visitChildNodes(node.Nodes(j))
Next
End Sub

0 comments:

Post a Comment

About this blog

Blog Archive

My Blog List

Advertise On This Site

Site Info

Advertise on this Site

To advertise on this site please mail on RajeshRolen@gmail.com

Information Source

About

Pages

Dot Net Academy

Advertis in This Area of Site

Powered by Blogger.

Followers

Blog Archive

Search This Blog