S4E

S4E

  • NA
  • 33
  • 0

Treeview right-click not selecting a node?

Nov 3 2004 7:58 AM
On a windows forms application, I've added a context menu and connected it to a treeview control. When I select a tree node, I'm having to left-click it first before a right click will do the right thing. Otherwise its as if the right-click works on the previosuly selected node. Any idea how to get around this? I'm checking the selected node in the context menu's item handler and it reports that the previous node is selected (if a right click wasnt preceded by a left click.) private void MenuItem_Click(object sender, System.EventArgs e) { TreeNode node = this.TreeView.SelectedNode; // check value of node.Tag // check value of node.Text }