Link to home
Start Free TrialLog in
Avatar of crp81
crp81

asked on

Indentify TreeView Nodes

How con I identify the individual node selected (Clicked) in a TreeView.

I want to do the same as I do with labels:

 private void label_MouseLeave(object sender, EventArgs e)
        {
            Label lbl = (Label)sender;   (How can I do this with nodes)
         }


I am a beginner programmer so please detail code, Thanks
ASKER CERTIFIED SOLUTION
Avatar of s_chilkury
s_chilkury
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rajeshrolen
rajeshrolen

I think the mouseLeave event will not resolve your issue. i will suggest to use NodeMouseClick event so when you will click on any node this event will get fired and you can than take node using e.Node and do stuff with it what ever you wants.

 private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            TreeNode tn = e.Node;
            MessageBox.Show(tn.Name);
        }

if this not get your desired result than plez provide me more detail that what exactly you wants to perform.

Thanks
this is good link, this will provide you more help with example regarding treeview:

http://dotnetperls.com/treeview