Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

keyAscci?

Status
Not open for further replies.

Fursten

Programmer
Joined
Dec 27, 2000
Messages
403
Location
PT
Hi,

Can someone tell me how can I lock a text field for input letters. I want only to let the user input numbers(0 -9)

Thank you
 
in the keypress proc write

Code:
If KeyAscii>31 then
   If isnumeric(chr(KeyAscii)) then
       if chr(KeyAscii) < 0 or chr(KeyAscii) > 9 then
            KeyAscii=0
       end if
   End if
End if
[\code]

Ciao
 
or, used in the same place, the slightly less readable
If Not (KeyAscii < 32 Or (KeyAscii > 48 And KeyAscii < 57)) Then
KeyAscii = 0
End If

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top