Click here to Skip to main content
15,917,481 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi,

I am capturing the event of the clicking the Selected Node of a TreeView in SelectedNodeChanged,but It is not firing everytime. But some times it is getting selected. SelectedNodeChanged should change since the selection has obviously changed but it is not working. So, what event can I catch so I know that the Selected Node was clicked?

And more importantly, one first Parent node and its child node is bing selected and remaing Parents are not even triggered. What is this behavior, any idea please?

I am adding nodes in this way!
TreeNode lObjTreeNode = null;

lObjTreeNode = new TreeNode("NewNode");

lObjTreeNode.SelectAction = =TreeNodeSelectAction.Select;

and adding the nodes.

Any ideas on this please.
Posted
Updated 27-Jan-11 20:27pm
v3

1 solution

I used the following code on .NET Framework 4 and 2.0 and it gave me the node which was selected:

private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
       {
           MessageBox.Show(e.Node.Text);
       }


Hope this helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900