What I am trying to achieve is when I right-click on a Node in the treeview control a menu will appear giving options to remove the current node, add a child node etc..

I am using the following to get the selected node:

VB Code:
  1. Me.tvwCompanies.SelectedNode = Me.tvwCompanies.GetNodeAt(New System.Drawing.Point(e.X, e.Y))

That in itself is not a problem, but if I right click on a space in the treeview control and not a node I get an error (which is understandable because I haven't actually selected a node).

Is there anyway I can find out whether I have right-clicked on a node or not and if not then don't do anything otherwise show the menu.

Regards,


Matt.