Hi revans611,
When you want to make a node being selected. You can set a node to the TreeView's SelectedNode property. To get a node you want to select from a TreeView control. You can visit its nodes property.
Here is the example to select the third child node in a treeview.
Dim value As TreeNode = treeView1.Nodes(2).Nodes(2)
treeView1.SelectedNode = value
treeView1.Focus()
If you want to find a treenode by its text, you can use the following code to select that node.
Private Sub FindNode(ByVal treeView As TreeView, ByVal nodeText As String)
Dim nodeStack As New Stack(Of TreeNode)()
For Each tn As TreeNode In treeView.Nodes
nodeStack.Push(tn)
Next
While nodeStack.Count <> 0
Dim treeNode As TreeNode = nodeStack.Pop()
If treeNode.Text = nodeText Then
treeView.SelectedNode = treeNode
Exit While
End If
For Each tn As TreeNode In treeNode.Nodes
nodeStack.Push(tn)
Next
End While
End Sub
Sincerely,
Kira Qian
Please mark the replies as answers if they help and unmark if they don't.