Treeview:: SelectedNode()

Hi,

I am working with a Treeview control for some Help Application... I have a node structure like the below one

N1

N110

N111

N112

N2

N210

N211

N212

If I Press or Click N110 I need to perform some operation. I am doing it in this way..

strSelectedNode = TreeView1.SelectedNode().Name

If (strSelectedNode = "N110") Then

.....

ElseIf (strSelectedNode = "N111") Then

End If

What happens is for the first time I am not getting correct SelectedNode().Name it refers to the previous or initial selection. Like if N1 is my default selection and if I press N110 still my SelectedNode().Name is N1. If press or click once again it showing correct SelectedNode().Name is there any thing I need to intialize before handling Mouse Click or Key Press event to get the SelectedNode().Name at time of Mouse Click or Key Press.

I am using Microsoft Visual Studio 2005.

Thanks,

Satheesh Kumarr C




Answer this question

Treeview:: SelectedNode()

  • mattpic

    See what happens when you put this is the the AfterSelect event

    strSelectedNode = TreeView1.SelectedNode().Name

    In this event you may even want to change this to

    strSelectedNode = e.item.name



  • SCISYS DBA

    This helps ReneeC.. But I have a question why Mouse Click or KeyPress didn't able to handle this. Any specific reasons to put it in AfterSelect() Method .



  • TaylorB

    Satheesh,

    What's the name of the event that you are in



  • JKRAFT PIT Rep

    TreeView_MouseClick()

    TreeView_Keyup()



  • Treeview:: SelectedNode()