How to disable textbox beep when pressing enter
By: Lorenzo Dalla Vecchia Date: 01/05/1998

In a single-line text box, when you press the enter key you hear a beep. This happens because you are not allowed to insert a carriage-return in one line.
This can be solved easly: in fact the beep is generated when the routine for the KeyPress event ends. So you can handle the enter key (ASCII code 13) and execute operations. Then, before the end of the routine, you can make Visual Basic believe no key was pressed. This can be done by inserting this line before the
End Sub statement:

KeyAscii = 0

Click Here!

Visual Basic Programming Zone is a website by Lorenzo Dalla Vecchia.
To contact the Webmaster, click here.
Hosted by InWind: