Home All Groups Group Topic Archive Search About

get the value of the selected node in a treeview

Author
31 Mar 2005 5:15 PM
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

Author
31 Mar 2005 5:29 PM
Herfried K. Wagner [MVP]
"Sam" <samuel.berthe***@voila.fr> schrieb:
> 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.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>