Private Function FindNode(ByVal ParentNode As TreeNode, _
ByVal SearchVal As String) As TreeNode
Dim tmpNode As TreeNode
If ParentNode.Text = SearchVal Then
Return ParentNode
Else
Dim child As TreeNode
For Each child In ParentNode.Nodes
tmpNode = FindNode(child, SearchVal)
If Not tmpNode Is Nothing Then
Return tmpNode
End If
Next
End If
Return Nothing
End Function
Private Function FindNode(ByVal TreeView As TreeView, _
ByVal strSearchVal As String) As TreeNode
Dim tmpNode As TreeNode
Dim ParentNode As TreeNode
For Each ParentNode In TreeView1.Nodes
tmpNode = FindNode(ParentNode, strSearchVal)
If Not tmpNode Is Nothing Then
Return tmpNode
End If
Next
End Function