Results 1 to 8 of 8

Thread: [2005] Contextual Menu Appearing When i dont want it to

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2006
    Location
    USA
    Posts
    42

    [2005] Contextual Menu Appearing When i dont want it to

    My Contextual menu appears no matter where in the treeview i RMB

    help

    attached image shows my treeview i only want it to appear on "Default" "Roll1" "Roll2" and Roll3"

    Madaxe



    Code:
    Private Sub TreeView1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseDown
            ' Show menu only if Right Mouse button is clicked
            If e.Button = MouseButtons.Right Then
    
                ' Point where mouse is clicked
                Dim p As Point = New Point(e.X, e.Y)
    
                ' Go to the node that the user clicked
                Dim node As TreeNode = TreeView1.GetNodeAt(p)
                TreeView1.SelectedNode = node
    
                If node Is Nothing Then Exit Sub
    
                If node.Text Is "Default" Then
                    ContextMenuStrip1.Show(TreeView1, New Point(e.X, e.Y))
                ElseIf node.Text Is "Roll1" Then
                    ContextMenuStrip1.Show(TreeView1, New Point(e.X, e.Y))
                ElseIf node.Text Is "Roll2" Then
                    ContextMenuStrip1.Show(TreeView1, New Point(e.X, e.Y))
                ElseIf node.Text Is "Roll3" Then
                    ContextMenuStrip1.Show(TreeView1, New Point(e.X, e.Y))
                ElseIf node.Text Is "Roll4" Then
                    ContextMenuStrip1.Show(TreeView1, New Point(e.X, e.Y))
                ElseIf node.Text Is "Roll5" Then
                    ContextMenuStrip1.Show(TreeView1, New Point(e.X, e.Y))
                ElseIf node.Text Is "Roll6" Then
                    ContextMenuStrip1.Show(TreeView1, New Point(e.X, e.Y))
                ElseIf node.Text Is "Roll7" Then
                    ContextMenuStrip1.Show(TreeView1, New Point(e.X, e.Y))
                ElseIf node.Text Is "Roll8" Then
                    ContextMenuStrip1.Show(TreeView1, New Point(e.X, e.Y))
                ElseIf node.Text Is "Roll9" Then
                    ContextMenuStrip1.Show(TreeView1, New Point(e.X, e.Y))
                ElseIf node.Text Is "Roll10" Then
                    ContextMenuStrip1.Show(TreeView1, New Point(e.X, e.Y))
    
                End If
    
            End If
    
        End Sub
    Attached Images Attached Images  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width