Results 1 to 7 of 7

Thread: [RESOLVED] Treenode search

Hybrid View

  1. #1
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: Treenode search

    try this. it's a recursive search:

    vb Code:
    1. Private Sub SearchTree(ByVal startNode As TreeNode, ByVal sSearchString As String)
    2.     If startNode.Text.Contains(sSearchString) Then
    3.         startNode.ForeColor = Color.Red
    4.     Else
    5.         startNode.ForeColor = Color.Black
    6.     End If
    7.     For Each n As TreeNode In startNode.Nodes
    8.         SearchTree(n, sSearchString)
    9.     Next
    10. End Sub

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337

    Re: Treenode search

    I thought it might be a recursive function. Was hoping there was another way.

    So, doing it that way, it is possible to pause it after each one found and then have a button to continue? until it reaches end?

    So search for a string, once it finds one stop search and highlight the node, instead of turning it a different color, but then have a button to continue the search from that spot on. I know I have to remember where it left off which shouldn't be a problem. but pausing it is the problem. how do you pause a recursive search lol

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width