convert lowercase letters into uppercase in the textbox in

The following code automatically converts all lowercase letters typed in a textbox control into uppercase.

'Just place a textbox control on your form and name it as txtTest.

'Add the following code in its KeyPress event.


Private Sub txtTest_KeyPress(KeyAscii As Integer)

    If KeyAscii >= 90 And KeyAscii <= 122 Then

        KeyAscii = KeyAscii - 32


        KeyAscii = 0

    End If

End Sub

Added on January 25, 2007 Comment