|
-
Sep 14th, 2000, 03:11 AM
#1
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?
-
Sep 14th, 2000, 03:29 AM
#2
Hyperactive Member
The easiest way is to check the value of the keycode for values in the range you require.
Regards
Chris
-
Sep 14th, 2000, 03:35 AM
#3
transcendental analytic
Code:
if not (IsAlphaNumeric(Chr(Keycode)) and IsNumeric(Chr(Keycode))) then 'neither numeric or alphanumeric
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Sep 14th, 2000, 04:36 AM
#4
Thanks for the replies.
Chrisa_Uk, that's the way i'm gonna do it.
Kedaman, IsAlphaNumeric isn't a VB-function.
-
Sep 14th, 2000, 07:11 AM
#5
PowerPoster
...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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|