Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get all the nodes at a particular level in treeview

Status
Not open for further replies.

swetham

Programmer
May 5, 2010
257
0
0
DE
How to get the collection of nodes at a particular level in a treeview?
 

Well, there isn't a collection of nodes at a particular level; you will have to make your own collection. Here's a function I use to determine the nesting level of a selected treenode:

Code:
        Function GetNodeNestingLevel(ByVal node As TreeNode) As Integer
            Dim iRetVal As Integer

            If node Is Nothing Then
                iRetVal = -1
            Else
                Do Until (node.Parent Is Nothing)
                    iRetVal += 1
                    node = node.Parent
                Loop
            End If

        End Function

What are you trying to do?


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top