Results 1 to 3 of 3

Thread: Can I disable the left mouse click

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2003
    Location
    Stourbridge, England, UK
    Posts
    171

    Can I disable the left mouse click

    Hello.

    On my form I have a Frame containing 6 Textbox's and I need to stop the user from clicking on these Textbox's with the Left mouse button but I still need the user to be able to Tab from one box to the next. On the forum I have seen a couple of code posts that claim to disable the mouse click but I cannot get either one to work.

    If anyone can help I would be most gratefull.

    Thanks.
    SKM

  2. #2
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Can I disable the left mouse click

    So, you want to prevent a TextBox from gaining the Focus when using the mouse?

  3. #3
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Can I disable the left mouse click

    Here is a simple solution using a hidden CommandButton (with it's TabStop diabled):
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.     cmdHidden.TabStop = False
    5. End Sub
    6.  
    7. Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    8.     If Button = vbLeftButton Then cmdHidden.SetFocus
    9. End Sub

    If your TextBox's were in a Control Array, then you would just need one line of code, as the example I provided will only do ONE of them .

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