I only want to dispaly a context menu in the treeview if a node is selected.
This is what I'm trying but it doesn't seem to work. The menu apprears if I right click in the treeview whether I'm on a node or not and will not go away until l click somewhere else.

vb Code:
  1. Private Sub tvwCharts_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles tvwCharts.MouseDown
  2.         If e.Button = Windows.Forms.MouseButtons.Right Then
  3.             Me.ContextMenuStrip1.Tag = tvwCharts.GetNodeAt(e.Location)
  4.             If ContextMenuStrip1.Tag Is Nothing Then
  5.                 ContextMenuStrip1.Visible = False
  6.             End If
  7.         End If
  8.     End Sub