Treeview - Get selected node?

  • Thread starter Thread starter Chris Ashley
  • Start date Start date
C

Chris Ashley

I'm trying to use a treeview for navigation in my windows forms app. How do
I find the currently selected node? If I use Treeview.SelectedNode.Index it
doesn't tell me where in the hierarchy the node is so I get the same number
more than once.
 
I'm trying to use a treeview for navigation in my windows forms app.
How do I find the currently selected node? If I use
Treeview.SelectedNode.Index it doesn't tell me where in the hierarchy
the node is so I get the same number more than once.

Chris

TreeNode tnSelected = Treeview.SelectedNode

will give you the node itself to examine, i.e. you can get its text,
fullpath etc.

What information do you want from the node to enable you to carry out
the next task in your app?
 

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