Treeview node selected

M

Mark

In Visual Basic 2008 how do I programmatically set a node to selected?

For example, my treeview has several nodes with dates, and I want set one
of the dates as selected because it happens to match a date variable.

How would I go about this?

Thanks for any help!
Mark
 
K

kimiraikkonen

In Visual Basic 2008 how do I programmatically set a node to selected?

For example, my treeview has several nodes with dates, and I want set one
of the dates as selected because it happens to match a date variable.

How would I go about this?

Thanks for any help!
Mark

Hi,
Your treeview may also need to get focus before seeing target node as
selected. For example if you want a node to see selected after a
button click you can use the syntax as:

/////////////////
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

TreeView1.Focus()
' SelectedNode property does the trick
TreeView1.SelectedNode = TreeView1.Nodes.Item("node_name")

End Sub
\\\\\\\\\\\\\\\\

Hope this helps,

Onur Güzel
 
H

Herfried K. Wagner [MVP]

Mark said:
In Visual Basic 2008 how do I programmatically set a node to selected?

'TreeView.SelectedNode', 'TreeNode.Select', 'TreeNode.Selected'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top