get the value of the selected node in a treeview

S

Sam

hi
i'm trying to get the value of the selected node in my treeview.
my code is:

txtTable1.Text = tvRelations.SelectedNode.Parent.ToString

but it adds the string 'TreeNode: ' to the value of the node (_56Zones)
as such:

TreeNode: _56Zones

Why ? and how can I get rid of that w/o having to use string functions
?

thx
 
H

Herfried K. Wagner [MVP]

Sam said:
i'm trying to get the value of the selected node in my treeview.
my code is:

txtTable1.Text = tvRelations.SelectedNode.Parent.ToString

but it adds the string 'TreeNode: ' to the value of the node (_56Zones)
as such:

TreeNode: _56Zones

Use 'SelectedNode.Parent.Text' instead. If you are storing a value in the
node's 'Tag' property, use 'SelectedNode.Parent.Tag.ToString()' to convert
the value to a string.
 

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