Treeview set selectednode

  • Thread starter Thread starter Sarah
  • Start date Start date
S

Sarah

Hi,

Just starting out with VB.NET. Got a treeview control
which lists drives/folders. Managed to write code to
dynamically add folder and show it, but now I want to
select this folder, so the user doesn't have to do it.

Something like:
treeview1.nodes(i).select
would be good but it doesn't exist??

Any Ideas?

TIA

Sarah
 
Hi Sarah,

In general, if TreeNode hasn't got it, look and see if TreeView does. And
vice versa.

And in this case, have a go with:
TreeView1.SelectedNode = TreeView1.Nodes(i)

Regards,
Fergus
 
* "Sarah said:
Just starting out with VB.NET. Got a treeview control
which lists drives/folders. Managed to write code to
dynamically add folder and show it, but now I want to
select this folder, so the user doesn't have to do it.

Something like:
treeview1.nodes(i).select
would be good but it doesn't exist??

'TreeView1.SelectedNode = TreeView.Nodes(i)'.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
 
And to just follow-up on Fergus and Herfrieds contributions, to save you a
bit of grief ensure that you also add

TreeView1.HideSelection = False

to your code.

Best regards
Hexathioorthooxalate
 
Hi Sarah,

|| See I said I was a novice!

She says proudly!! ;-))

Are you the starving Newbie with the potty dotty printer?

Best regards,
Fergus
 

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

Back
Top