Getting the selected tree node's text?
-
Hi, I've got a question regarding the treeview control on a C# windows form. How can I get the text of the selected treeview node? I know I need the .Text property to get the string, I just can't seem to get the selected/active treenode. I want to take part of that text and put it in a tool tip. I've got the tooltip part working but I'm getting the parent tree nodes text. The tree structure looks like this.
Last Name Smith Wallace First Name John William
Thanks :) -
Hi, I've got a question regarding the treeview control on a C# windows form. How can I get the text of the selected treeview node? I know I need the .Text property to get the string, I just can't seem to get the selected/active treenode. I want to take part of that text and put it in a tool tip. I've got the tooltip part working but I'm getting the parent tree nodes text. The tree structure looks like this.
Last Name Smith Wallace First Name John William
Thanks :) -
Manster wrote: How can I get the text of the selected treeview node? In away like this:
string str="";
if(treeview.SelectedNode!=null)
str = treeview.SelectedNode.TextMazy No sig. available now.
Mazdak, Thanks for your help. I'm actually trying to get the child node from the code you listed above. So if I'm currently getting "Last Name" returned to me now, I'm trying to get "Wallace" instead. This is the tree structure. Last Name Wallace A child node is selected and I need it's text. Is this possible? This is the tree structure. Thanks
-
Mazdak, Thanks for your help. I'm actually trying to get the child node from the code you listed above. So if I'm currently getting "Last Name" returned to me now, I'm trying to get "Wallace" instead. This is the tree structure. Last Name Wallace A child node is selected and I need it's text. Is this possible? This is the tree structure. Thanks