devxlogo

Expanding All the Subnodes For a Node in a TreeView

Expanding All the Subnodes For a Node in a TreeView

The following recursive function allows users to do an expand all via apopup 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 IfEnd SubPrivate Sub mnuExpand_Click()    ' Hide the TreeView and things will go much faster    tvwTree.Visible = False    ExpandAll tvwTree.SelectedItem    tvwTree.Visible = TrueEnd Sub

size=3>

devx-admin

Share the Post: