none
How to keep only the matched node structs when searching in AdvTree list? RRS feed

  • Question

  • I have AdvTree control and the tree list is multi-level struct, now I need to build the search function to loop through all nodes using the recursive function, hide the nodes that not matched searched value. But how to only keep the matched tree list? The code is below.

    Private Sub FilterAllNodes(ByVal objNC As NodeCollection, ByVal ComparedString As String)
            Dim nodeMatched As Boolean
            For Each node As Node In objNC
                If node.HasChildNodes = False Then
                    If Node.text=ComparedString Then       
                        nodeMatched = True
                     End If          
                    node.Visible = nodeMatched
                Else
                    FilterAllNodes(node.Nodes, ComparedString)
                End If
            Next
        End Sub

    View the image below, only remain the red region.


    Friday, September 20, 2019 6:49 AM

All replies

  • Hi,

    I'm sorry that your case is related to third-party control, so this thread is off-topic.

    Best Regards,

    Julie


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, September 23, 2019 5:42 AM