[VB 2008] Select a TreeView Node

  • Thread starter Thread starter vino
  • Start date Start date
V

vino

Hello

I have created a TreeView and i wish to select a node into it
and then expand the selected node.

Is someone has an idea ?

Thanks
 
I have created a TreeView and i wish to select a node into it
and then expand the selected node.

Is someone has an idea ?

Assuming you mean a WinForms TreeView control:

yourTreeView.SelectedNode = ...
yourTreeView.SelectedNode.Expand()


Mattias
 
Hi Mattias and thank you for your answer.

But the SelectedNode doesn't select the Node like a user click on it (with a
blue bgcolor)
Is there a solution to do it automatically without setting its BackColor
property to Blue ?
 
vino, ye decaying cozening slave, thou bawd, thou broker, thou all
changing word, ye pealed:
Hi Mattias and thank you for your answer.

But the SelectedNode doesn't select the Node like a user click on it (with
a
blue bgcolor)
Is there a solution to do it automatically without setting its BackColor
property to Blue ?


If you have code in the AfterSelect event handler that you want to execute
when you select a node via code then move all the code out of the
AfterSelect handler into another routine. Call the routine from the
AfterSelect handler and call it when you set the SelectedNode in code.
 
vino said:
But the SelectedNode doesn't select the Node like a user click on it (with
a
blue bgcolor)
Is there a solution to do it automatically without setting its BackColor
property to Blue ?

\\\
Me.TreeView1.SelectedNode = ...
Me.TreeView1.Focus()
///

Take a look at the 'HideSelection' property too.
 
Back
Top