Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Mar 5, 2001

Expanding All the Subnodes For a Node in a TreeView


The following recursive function allows users to do an expand all via a popup menu:
 
Public Sub ExpandAll(ByVal aNode As Node)
    Dim l_Counter As Long
    Dim l_Children As Long
    Dim temp_Node As Node

    l_Children = aNode.Children

    If l_Children Then
        aNode.Expanded = True
        Set temp_Node = aNode.Child
        For l_Counter = 0 To l_Children - 1
            ExpandAll temp_Node
            Set temp_Node = temp_Node.Next
        Next l_Counter
    End If

End Sub


Private Sub mnuExpand_Click()
    ' Hide the TreeView and things will go much faster
    tvwTree.Visible = False
    ExpandAll tvwTree.SelectedItem
    tvwTree.Visible = True
End Sub
Ahmad Khalil
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap