Private Sub TPR_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
Select Case Chr(KeyAscii)
Case 0 To 9
KeyAscii = 0
End Select
End Sub
Bit convoluted (I'd use [tt]Case 48 to 57[/tt] and avoid any preprocessing of KeyAscii, since KeyAscii gets passed on to the default handler for the control), but essentially yes. I'd also put in a string length check here as well to meet your "max lenght 2 cahracter" requirement
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.