i have a class:
VB Code:
Public Class FilesFoldersList Inherits Windows.Forms.TreeView Public Quit As Boolean = False Public Function FindNode(ByVal TNC As TreeNodeCollection, ByVal Text As String) As Windows.Forms.TreeNode Dim TN As TreeNode For Each TN In TNC If Quit = True Then Exit Function Debug.WriteLine(TN.Text) If TN.Text = Text Then FindNode = TN Quit = True Exit Function End If FindNode(TN.Nodes, Text) Next End Function End Class
which i use to find a certain node in a treeview, and this is how i use it:
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim TN As TreeNode TN = FFList.FindNode(FFList.Nodes, "C:\timem") MsgBox(TN.Text) End Sub
the FindNodes function works, but it won't return anything. I checked everything and it should work. it keeps saying that TN=Nothing. anyone see what is the problem?




.
Reply With Quote