TreeView right click not selected

A

Alan T

I selected a node in treeview, however, if I right click another node and
after exited the pop up menu this "right clicked" node is not selected.
How do I make this "right clicked" node is selected after right clicked?
 
M

Mark Rendle

Assuming you're using .NET 2.0, handle the NodeMouseClick event like this:

private void treeView1_NodeMouseClick(object sender,
TreeNodeMouseClickEventArgs e)
{
if(e.Button == MouseButtons.Right)
{
treeView1.SelectedNode = e.Node;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top