Convert lower-case letter to upper-case letter

vagelisr

Registered User.
Local time
Today, 02:04
Joined
Apr 28, 2011
Messages
87
Accept only upper-case letter

Hi to all

I want when the user type lower-case letters convert to upper-case letters

After some dig in the internet i found this KeyAscii = Asc(UCase(Chr(KeyAscii))) on the keypress event where it works great for English characters BUT when i type Greek characters they show me runtime error 5

Any idea???
 
Last edited:
do it AFTER they type it all in. Then you only need 1 line in the Afterupdate event.

Code:
sub textBox_Afterupdate()
    textBox = ucase(textBox)
end sub
 
First of all thanks Ranman256 for your time.

Yes i know this but the point is i don't want the user be able to press a lower case character.....

PS You give me a correct answer. I had write wrong subject......
 
Last edited:
You could use AscW and ChrW in place of Asc and Chr like:

Code:
KeyAscii = AscW(UCase(ChrW(KeyAscii)))
 
Code:
Private Sub Text0_KeyPress(KeyAscii As Integer)
    Select Case KeyAscii
    Case 97 To 122: KeyAscii = KeyAscii - 32
    End Select
End Sub
 
First of all thanks for your time.
sneeuberg the code you send work like a charm!!!!!
static to be absolutely honest i dont even try your code
 

Users who are viewing this thread

Back
Top Bottom