Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

ASP.net VB.net TreeView - Loop through all nodes and child nodes

Hi. I am trying to loop through all nodes  and child nodes in a TreeView.
The following code just loop through the first two levels of nodes.
I don't know how many levels there are so I need to find code that
automatically finds all nodes and TreeNodes


   For i As Integer = 0 To Me.TreeViewOrg.Nodes.Count - 1
            oNodeText = Me.TreeViewOrg.Nodes(i).Text

        Next

  For i As Integer = 0 To Me.TreeViewOrg.Nodes(0).ChildNodes.Count - 1
            oNodeText = Me.TreeViewOrg.Nodes(0).ChildNodes(i).Text
   
        Next
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Murray Brown

ASKER

Perfect. Did the trick! Thanks