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:
Private Sub tvwCharts_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles tvwCharts.MouseDown If e.Button = Windows.Forms.MouseButtons.Right Then Me.ContextMenuStrip1.Tag = tvwCharts.GetNodeAt(e.Location) If ContextMenuStrip1.Tag Is Nothing Then ContextMenuStrip1.Visible = False End If End If End Sub


Reply With Quote
