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.
Re: Textbox_Keypress = 13 Event produces sound
Which operating system are you using?
Re: Textbox_Keypress = 13 Event produces sound
I'm sorry, I should have included that.
Using Windows 7 Ultimate.
Re: Textbox_Keypress = 13 Event produces sound
If your TextBox isn't MultiLine, then you will indeed hear a "ding" sound.
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.
Re: Textbox_Keypress = 13 Event produces sound
To explain further what Bonnie is saying read the last post here.
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?
Re: Textbox_Keypress = 13 Event produces sound
Quote:
Originally Posted by
funkyjtq
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.
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