T
ThunderMusic
Hi,
while I'm searching into a treeview to find a specific node, I find the
code duplicating treeview nodes I just can't figure out what's causing this
behavior, maybe some of you already encountered this problem. Can someone
help please?
Here is the code of the functions causing this problem
Thanks
ThunderMusic
Private Function FindTVNode(ByVal Path As String) As TreeNode
Dim FoundNode As TreeNode
Dim Cpt As Integer
Dim Found As Boolean
Found = False
Cpt = 0
Do While (Not Found) And Cpt < TVAll.GetNodeCount(False)
If TVAll.Nodes.Item(Cpt).FullPath = Path Then
FoundNode = TVAll.Nodes.Item(Cpt)
Found = True
Else
FoundNode = FindTVNodeRec(TVAll.Nodes.Item(Cpt), Path)
If FoundNode Is Nothing Then
Cpt += 1
Else
Found = True
End If
End If
Loop
FindTVNode = FoundNode
End Function
Private Function FindTVNodeRec(ByRef Node As TreeNode, ByVal Path As String)
As TreeNode
Dim FoundNode As TreeNode
Dim Cpt As Integer
Dim Found As Boolean
FoundNode = Nothing
Cpt = 0
Found = False
Do While Not (Found) And Cpt < Node.GetNodeCount(False)
If Node.Nodes.Item(Cpt).FullPath = Path Then
FoundNode = Node.Nodes.Item(Cpt)
Found = True
Else
FoundNode = FindTVNodeRec(TVAll.Nodes.Item(Cpt), Path)
If FoundNode Is Nothing Then
Cpt += 1
Else
Found = True
End If
End If
Loop
FindTVNodeRec = FoundNode
End Function
while I'm searching into a treeview to find a specific node, I find the
code duplicating treeview nodes I just can't figure out what's causing this
behavior, maybe some of you already encountered this problem. Can someone
help please?
Here is the code of the functions causing this problem
Thanks
ThunderMusic
Private Function FindTVNode(ByVal Path As String) As TreeNode
Dim FoundNode As TreeNode
Dim Cpt As Integer
Dim Found As Boolean
Found = False
Cpt = 0
Do While (Not Found) And Cpt < TVAll.GetNodeCount(False)
If TVAll.Nodes.Item(Cpt).FullPath = Path Then
FoundNode = TVAll.Nodes.Item(Cpt)
Found = True
Else
FoundNode = FindTVNodeRec(TVAll.Nodes.Item(Cpt), Path)
If FoundNode Is Nothing Then
Cpt += 1
Else
Found = True
End If
End If
Loop
FindTVNode = FoundNode
End Function
Private Function FindTVNodeRec(ByRef Node As TreeNode, ByVal Path As String)
As TreeNode
Dim FoundNode As TreeNode
Dim Cpt As Integer
Dim Found As Boolean
FoundNode = Nothing
Cpt = 0
Found = False
Do While Not (Found) And Cpt < Node.GetNodeCount(False)
If Node.Nodes.Item(Cpt).FullPath = Path Then
FoundNode = Node.Nodes.Item(Cpt)
Found = True
Else
FoundNode = FindTVNodeRec(TVAll.Nodes.Item(Cpt), Path)
If FoundNode Is Nothing Then
Cpt += 1
Else
Found = True
End If
End If
Loop
FindTVNodeRec = FoundNode
End Function