Connecting Tech Pros Worldwide Forums | Help | Site Map

Treeview Selected Item

Marc Jennings
Guest
 
Posts: n/a
#1: Nov 16 '05
Hi

There is probably a very simple answer to this, but I am not too
familiar with the treeView control...

I have a treeview control, populated from a database. I want to be
able to get the text property of the slected node when a user selects
one, but I don't know which methods to use.

If I try "Click" or "MouseDown", the returned string seems to be the
text of the previously selected item. (eg. "Item 17" is selected.
Click Item 4 and the returned value of treeNode1.SelectedNode.Text is
"Item17")

Can anyone point me at a resource to show me how to accurately get the
value of the *currently* selected item, or tell me which event I need
to trap to get the desired results.

(Of course, keyboard navigation is going to be an issue as well...)

TIA
Marc.

Marc Jennings
Guest
 
Posts: n/a
#2: Nov 16 '05

re: Treeview Selected Item


Oops. Found it. I was using the "Click" event of the treeview
control. I just discovered there is an "AfterSelect" method.

I love Google. :)

On Fri, 12 Nov 2004 10:31:50 +0000, Marc Jennings
<MarcJennings@community.nospam> wrote:
[color=blue]
>Hi
>
>There is probably a very simple answer to this, but I am not too
>familiar with the treeView control...
>
>I have a treeview control, populated from a database. I want to be
>able to get the text property of the slected node when a user selects
>one, but I don't know which methods to use.
>
>If I try "Click" or "MouseDown", the returned string seems to be the
>text of the previously selected item. (eg. "Item 17" is selected.
>Click Item 4 and the returned value of treeNode1.SelectedNode.Text is
>"Item17")
>
>Can anyone point me at a resource to show me how to accurately get the
>value of the *currently* selected item, or tell me which event I need
>to trap to get the desired results.
>
>(Of course, keyboard navigation is going to be an issue as well...)
>
>TIA
>Marc.[/color]

Closed Thread