Did a bit of digging, and it looks like you need to capture the value of the right mouse click, and select the node at that point. See this code snippet (Grabbed from
tek-tips.com)
Code:
Private Sub TreeView1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseDown
Dim dp As System.Drawing.Point
If e.Button = MouseButtons.Right Then
'select node that is being right-clicked
TreeView1.SelectedNode = TreeView1.GetNodeAt(e.X, e.Y)
'Get the nesting level of the selected node
NodeLevel = GetNodeNestingLevel(TreeView1.SelectedNode)
'only display context menu on lowest-level nodes
If NodeLevel = 3 Then
TreeView1.ContextMenu = TVMenu
Else
TreeView1.ContextMenu = Nothing
End If
End If
NodeLevel = -1
End Sub
Hope that helps. Check the link above for more information if you need it.
Enter your message below
Sign in or Join us (it's free).