Results 1 to 9 of 9

Thread: Textbox_Keypress = 13 Event produces sound

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2010
    Location
    Melbourne, Australia
    Posts
    92

    Question Textbox_Keypress = 13 Event produces sound

    I have code similar to the following in my project:

    Code:
    Private Sub Text1_KeyPress(KeyAscii As Integer)
        If KeyAscii = 13 Then
            MsgBox "Enter pressed.",vbOkonly,"Result"
        End If
    End Sub
    Why does this produce similar to a 'ding' sound in Windows, and what can I do to stop it? I prefer not to mute my speakers, surely there is something that can be done to suppress the sound.

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Textbox_Keypress = 13 Event produces sound

    Which operating system are you using?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2010
    Location
    Melbourne, Australia
    Posts
    92

    Re: Textbox_Keypress = 13 Event produces sound

    I'm sorry, I should have included that.

    Using Windows 7 Ultimate.

  4. #4
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: Textbox_Keypress = 13 Event produces sound

    If your TextBox isn't MultiLine, then you will indeed hear a "ding" sound.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Sep 2010
    Location
    Melbourne, Australia
    Posts
    92

    Re: Textbox_Keypress = 13 Event produces sound

    So I'd have to change to multiline to stop the ding sound... Will see if that works in my project.

    Thanks Bonnie West.

  6. #6
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Textbox_Keypress = 13 Event produces sound

    To explain further what Bonnie is saying read the last post here.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Sep 2010
    Location
    Melbourne, Australia
    Posts
    92

    Re: Textbox_Keypress = 13 Event produces sound

    My textboxes use only one line. If I set them to MultiLine, when I press enter the textbox looks like it clears (because it's going to the next line).

    Not sure how to solve this?

  8. #8
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Textbox_Keypress = 13 Event produces sound

    Quote Originally Posted by funkyjtq View Post
    My textboxes use only one line. If I set them to MultiLine, when I press enter the textbox looks like it clears (because it's going to the next line).

    Not sure how to solve this?
    Adjust the height of the textbox.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  9. #9
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Textbox_Keypress = 13 Event produces sound

    Add a line to your code
    Code:
    Private Sub Text1_KeyPress(KeyAscii As Integer)
        If KeyAscii = 13 Then
            KeyAscii=0
            MsgBox "Enter pressed.",vbOkonly,"Result"
        End If
    End Sub

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