I have a textbox on my form, and if the user hits the enter key, the program executes some code, but it also beeps.
How do I stop it from beeping?
Printable View
I have a textbox on my form, and if the user hits the enter key, the program executes some code, but it also beeps.
How do I stop it from beeping?
If you are running some code on an enter key press, i am guessing that you are testing for the enter key. Once you know it is the enter key, set the KeyAscii / KeyCode = 0. That will stop it beeping.
This will solve your problem:
SunnyCode:Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
'your thing here
KeyAscii = 0
'this resets KeyAscii, so its like no key was
'pressed at all
End If
End Sub
Or you can use a hidden default button with sendkeys code in the click event :)