Can anyone tell me the range of ascii values that are numbers???
Printable View
Can anyone tell me the range of ascii values that are numbers???
48 to 57
'easy way to get an ascii of your keypress
Code:Private Sub Text1_KeyPress(KeyAscii As Integer)
MsgBox KeyAscii
End Sub
Do you know of any problems the following could cause?
'Test for numeric ascii values?
If Not IsNumeric(Chr(KeyAscii))
None if it's in the right event..ie Keypress as below
However, that does not allow for backspace or decimals if
needed.
'allow only numeric data in a textbox
Option Explicit
Private Sub Text1_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) Then
KeyAscii = 13
Beep 'if not numeric then beep
End Sub