Results 1 to 11 of 11

Thread: textbox and mouse_down event

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Location
    Lucenec, Slovakia
    Posts
    154

    Unhappy textbox and mouse_down event

    Hi guys,

    I would like to make sensible textbox to mouse_down event.

    I have created userform1, textbox4. Can anybody help me, why the following code is wrong?
    VB Code:
    1. Private Sub Textbox4_MouseDown(ByVal Button As Integer)
    2. If Button = 1 Then UserForm2.Show
    3. End Sub

    Thanks.

    Boris

  2. #2
    Frenzied Member
    Join Date
    May 2003
    Location
    Sydney
    Posts
    1,123

    Re: textbox and mouse_down event

    maybe u should use the click event.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Location
    Lucenec, Slovakia
    Posts
    154

    Re: textbox and mouse_down event

    Quote Originally Posted by mebhas
    maybe u should use the click event.
    can you send me an example?

    thanks boris

  4. #4
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: textbox and mouse_down event

    Quote Originally Posted by bolcskei
    Hi guys,

    I would like to make sensible textbox to mouse_down event.

    I have created userform1, textbox4. Can anybody help me, why the following code is wrong?
    VB Code:
    1. Private Sub Textbox4_MouseDown(ByVal Button As Integer)
    2. If Button = 1 Then UserForm2.Show
    3. End Sub

    Thanks.

    Boris
    This code works fine for me:

    VB Code:
    1. Private Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.     If Button = 1 Then Form2.Show
    3. End Sub
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Location
    Lucenec, Slovakia
    Posts
    154

    Re: textbox and mouse_down event

    Quote Originally Posted by Mark Gambo
    This code works fine for me:

    VB Code:
    1. Private Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.     If Button = 1 Then Form2.Show
    3. End Sub
    it writes me "Procedure declaration does not match description of event or procedure having the same name" error.

    Boris

  6. #6
    Frenzied Member
    Join Date
    May 2003
    Location
    Sydney
    Posts
    1,123

    Re: textbox and mouse_down event

    it writes me "Procedure declaration does not match description of event or procedure having the same name" error.
    u should change the text1_mouseup to textbox4_mouseup

    and as for the click event,
    VB Code:
    1. Private Sub TextBox4_Click()
    2.     Form2.Show
    3. End Sub

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Location
    Lucenec, Slovakia
    Posts
    154

    Re: textbox and mouse_down event

    Quote Originally Posted by mebhas
    u should change the text1_mouseup to textbox4_mouseup

    and as for the click event,
    VB Code:
    1. Private Sub TextBox4_Click()
    2.     Form2.Show
    3. End Sub
    That time I have changed it to
    VB Code:
    1. Private Sub Textbox4_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2. If Button = 1 Then UserForm2.Show
    3. End Sub
    But it did not worked. I was also trying
    VB Code:
    1. Private Sub TextBox4_click()
    2. UserForm2.Show (vbModeless)
    3. End Sub
    At the moment works me:
    VB Code:
    1. Private Sub textbox4_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    2. If Cancel.Value = False Then UserForm2.Show
    3. End Sub

    May be I have version of VB where the click event do not work, but I do not understand the problem with mouse_down, because in help I have found it.

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: textbox and mouse_down event

    Are you using VB or VBA?

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Location
    Lucenec, Slovakia
    Posts
    154

    Re: textbox and mouse_down event

    Quote Originally Posted by Hack
    Are you using VB or VBA?
    I have Visual Basic Editor as a part of office and thefore I think I have VBA.

  10. #10
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: textbox and mouse_down event

    Quote Originally Posted by bolcskei
    I have Visual Basic Editor as a part of office and thefore I think I have VBA.
    And that is why some of the proposed solutions that have been posted aren't working for you. VBA is a subset of VB, and many of the features of VB are not supported in VBA.

    You will receive VBA specific help from the Office Development folks.

    Moved.

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Location
    Lucenec, Slovakia
    Posts
    154

    Re: textbox and mouse_down event

    Quote Originally Posted by Hack
    And that is why some of the proposed solutions that have been posted aren't working for you. VBA is a subset of VB, and many of the features of VB are not supported in VBA.

    You will receive VBA specific help from the Office Development folks.

    Moved.
    Thank you

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