How to select a node in the tree control programatically in

I have a populated tree control, and I want programatically to set focus (with highlight) to a specific node, that could be in the visible area or not (including moving to the top or bottom. How to do that programatically in
Thanks in advance
Who is Participating?
Slow_moConnect With a Mentor Commented:
Additionaly you can set a HideSelection property to false to be able to see selected node even if TreeView is not focused.
Me.TreeView1.SelectedNode = Me.TreeView1.Nodes(1)

This will select the second root node

To select the first child node of a second root node use this:

Me.TreeView1.SelectedNode = Me.TreeView1.Nodes(1).Nodes(0)
Bear in mind that the treeview may not be focussed (depending on when you are selecting the node). If you want to subsiquently focus it you can use Me.TreeView1.Focus()
fmichailAuthor Commented:
Thank you slow mo
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.