Treeview

G

Guest

How do I programmatically set the focus to a specific node? The node would be
6 levels deep in the tree.
 
H

Herfried K. Wagner [MVP]

Arne said:
How do I programmatically set the focus to a specific node? The node would
be
6 levels deep in the tree.

Assign the node to the control's 'SelectedNode' property.
 
G

Guest

I'm having the same problem

The treeview doesn't have a public property selectedNode
it has a selectedNodeIndex, and it's already set to the node's index.

When you scroll down, you can see that the node is actually selected. The
problem is that the focus isn't set to that node and you have to scroll to
see it.

Is there a work around this?
 
G

Guest

I'm having the same problem

The treeview doesn't have a public property selectedNode
it has a selectedNodeIndex, and it's already set to the node's index.

When you scroll down, you can see that the node is actually selected. The
problem is that the focus isn't set to that node and you have to scroll to
see it.

Is there a work around this?
 
H

Herfried K. Wagner [MVP]

S said:
The treeview doesn't have a public property selectedNode
it has a selectedNodeIndex, and it's already set to the node's index.

The Windows Forms treeview control actually has a 'SelectedNode' property.
When you scroll down, you can see that the node is actually selected. The
problem is that the focus isn't set to that node and you have to scroll to
see it.

You may want to call the 'TreeNode' object's 'EnsureVisible' method.
 

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