Results 1 to 11 of 11

Thread: [RESOLVED] Right Click Disabled

  1. #1

    Thread Starter
    Lively Member VBN00b001's Avatar
    Join Date
    Feb 2007
    Posts
    68

    Resolved [RESOLVED] Right Click Disabled

    How can i Disable the Right click in my program?
    Last edited by VBN00b001; Feb 27th, 2007 at 06:35 PM.

  2. #2

  3. #3

    Thread Starter
    Lively Member VBN00b001's Avatar
    Join Date
    Feb 2007
    Posts
    68

    Re: Right Click

    What you mean?

  4. #4
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Right Click

    Quote Originally Posted by VBN00b001
    What you mean?
    Right-click will only pop-up a menu in specific controls or if you call it on the form_click event.

    If you are trying to disable a right-click on a textbox or richtextbox, we need to know to show you how to disable it.
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  5. #5
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: Right Click

    If i understand you correctly, you want to disable right click - as you said, right? So, standard controls don't "react" on right click if not specified - with code (MouseUp, MouseDown... events). If you have some code for those, simply remove/comment it.

  6. #6

    Thread Starter
    Lively Member VBN00b001's Avatar
    Join Date
    Feb 2007
    Posts
    68

    Re: Right Click

    Well I guess Its for a text Box Which displays the output

  7. #7
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Right Click

    Here is how to do it for a textbox

    vb Code:
    1. Option Explicit
    2.  
    3. Dim bIsRightClk As Boolean
    4.  
    5.  
    6.  
    7. Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    8.  
    9.  If Button = 2 Then
    10.      bIsRightClk = True
    11.  End If
    12.  
    13. End Sub
    14.  
    15. Private Sub Form_Load()
    16.      bIsRightClk = False
    17. End Sub
    18.  
    19. Private Sub Text1_GotFocus()
    20.  
    21.    If bIsRightClk = True Then
    22.           Text1.Enabled = False
    23.           Me.SetFocus
    24.           Text1.Enabled = True
    25.    End If
    26.  
    27. End Sub
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  8. #8

    Thread Starter
    Lively Member VBN00b001's Avatar
    Join Date
    Feb 2007
    Posts
    68

    Re: Right Click

    Wow thanks a lot, just one more question what does enabled do
    Code:
    Text1.Enabled
    And what does the 2 value do

    Code:
    If Button = 2 Then

  9. #9
    Hyperactive Member Capp's Avatar
    Join Date
    May 2005
    Location
    Texas
    Posts
    409

    Re: Right Click

    Quote Originally Posted by VBN00b001
    Wow thanks a lot, just one more question what does enabled do
    Code:
    Text1.Enabled
    And what does the 2 value do

    Code:
    If Button = 2 Then

    .Enabled means can you click it or not. It basically "locks" it so you can't do anything with it if set to False.

    Button=2 means the 2nd button, or right-mouse button
    AmazingAntivirus.com
    Remote Data Backups


    Please Mark your Thread "Resolved", if the query is solved...

    If a post has helped you then Please Rate it!

  10. #10

    Thread Starter
    Lively Member VBN00b001's Avatar
    Join Date
    Feb 2007
    Posts
    68

    Re: Right Click

    Thank you

  11. #11
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: [RESOLVED] Right Click Disabled

    Just a tip... rather use built-in constant/s instead of a number/s:
    Code:
    If Button = vbRightButton Then
    Type vb in your code editor and press CTRL+SPACE and you'll get a complete list of theme

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