Robin V. Robin V. - 1 year ago 134
C# Question

Get treenode from contextmenu-item eventHandler

I've got a treeview with several treenodes. When I right-click a treenode i get a contextmenu
with different options, for example 'delete item'.

Is there a simple way to get the treenode object, that was right-clicked, in the eventHandler of the contextmenu-item ?

Answer Source

If you (right)click a node, doesn't it become the selected node?

TreeNode needed = TreeViewX.SelectedNode;


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download