Results 1 to 5 of 5

Thread: RightClick Event?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    21

    Question

    Hello, Does anyone know how to capture a right-click event button from the mouse. For example, I have a DataGrid full of info and when the user selects a row and right clicks, I want to open another form. Is there a way I can code the right mouse button, or even better, on a 3-button mouse how would I capture each buttons click event? Thanks in advance.

  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    Query the button argument of the event.
    Oetje
    [email protected]
    93606776
    Visual Basic 6, Windows 2000

    Never pet a burning dog

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    21
    Could you be a little more specific? perhaps a line of code example. Thanks!

  4. #4
    Guest
    Use the MouseDown or MouseUp event.
    Code:
    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Button = vbRightButton Then MsgBox "Right Button pressed"
        If Button = vbMiddleButton Then MsgBox "Middle Button pressed"
        If Button = vbLeftButton Then MsgBox "Left Button pressed"
    End Sub

  5. #5
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    Sorry that my explanation was a little bad. I'm lazy today...
    Oetje
    [email protected]
    93606776
    Visual Basic 6, Windows 2000

    Never pet a burning dog

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