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?
 
Back
Top