If Not IsNumeric(Chr(KeyAscii)) Then KeyAscii = 13
I am using the above and need to add backspace and decimal to the allowed characters. I'm at work and don'thave msdn to look it up...
Help please...code...chr(ascii) what?
Printable View
If Not IsNumeric(Chr(KeyAscii)) Then KeyAscii = 13
I am using the above and need to add backspace and decimal to the allowed characters. I'm at work and don'thave msdn to look it up...
Help please...code...chr(ascii) what?
text box called text1....
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 8 Then Exit Sub ' backspace
If KeyAscii = 46 Then
If InStr(1, Text1.Text, ",") <> 0 Then ' only allow one decimal
KeyAscii = 0
Else
Exit Sub ' decimal
End If
End If
If Not IsNumeric(Chr(KeyAscii)) Then KeyAscii = 0
End Sub
Thanks,
Wayne