devxlogo

Enforce Uppercase Characters

Enforce Uppercase Characters

Do you want to facilitate the user to enter only uppercase charactersduring editing in text boxes and other edit controls? Irrespectiveof the position of CAPS LOCK key, this code in the KeyPress eventof the Form will force the user always to enter uppercase characters.

 Private Sub Form_KeyPress(KeyAscii _        As Integer)KeyAscii = Asc(UCase(Chr(KeyAscii)))End Sub

For this code to work, you need to set the KeyPreview propertyof the Form to True.

devx-admin

Share the Post: