-
Does anybody know a function that can see if a keycode is alphanumeric?
With the KeyDown-procedure I want something done only when a numeric or alphanumeric key is pressed.
So I want to eliminate all the function keys, tab, arrows,...
Or maybe anyone knows a function to see if the key that was hit was a function key?
-
The easiest way is to check the value of the keycode for values in the range you require.
Regards
Chris
-
Code:
if not (IsAlphaNumeric(Chr(Keycode)) and IsNumeric(Chr(Keycode))) then 'neither numeric or alphanumeric
-
Thanks for the replies.
Chrisa_Uk, that's the way i'm gonna do it.
Kedaman, IsAlphaNumeric isn't a VB-function.
-
...or if you need only defined chars you can check the input like this:
Code:
Dim Temp as String
Temp = "abcdefghijklmnopqrstuvwxyz0123456789,.-"
If InStr( 1, Temp, LCase( Chr( KeyCode ) ) ) > 0 Then
'Key pressed is one of the defined chars
Endif