I ended up using a Queue
and then going through the TreeList using the current node's tree.nodes
.
Dim text As String = "looking for this"
Dim myQueue As New Queue
For i As Integer = 0 To tree.Nodes.Count - 1
If tree.Nodes(i).GetDisplayText("name").Equals(text ) Then
tree.SetFocusedNode(tree.Nodes(i))
Exit Sub
Else
If tree.Nodes(i).HasChildren Then
myQueue.Enqueue(tree.Nodes(i))
End If
End If
Next
While myQueue.Count > 0
Dim tempNode As DevExpress.XtraTreeList.Nodes.TreeListNode = CType(myQueue.Dequeue, DevExpress.XtraTreeList.Nodes.TreeListNode)
For i As Integer = 0 To tempNode.Nodes.Count - 1
If tempNode.Nodes(i).GetDisplayText("name").Equals(e.Button.Caption) Then
tree.SetFocusedNode(tempNode.Nodes(i))
Exit Sub
Else
If tempNode.Nodes(i).HasChildren Then
myQueue.Enqueue(tempNode.Nodes(i))
End If
End If
Next
End While