Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Format control in text boxes
Message
 
To
02/02/1999 14:40:55
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00172977
Message ID:
00183121
Views:
24
>Hi, Bob.
>
>In that case then, you can use the keypress event to trap the keystrokes you don't want to allow, and issue a NODEFAULT if one is pressed.
>
>HTH
>
>>Thanks Nancy, et.al.
>>I guess I wasn't specific enough - I do not want the user to be able to enter any special characters either! If I just use "!" then things like *$&@#^)#!% are allowed and I will have to censor my file names! :-)

Rather than trapping all the disallowed ones, it sounds like in Bob's case the code should be like
* Allow only digit or uppercase alpha:
IF NOT ( BETW(nKeyPress,48,57) OR BETW(nKeyPress, 65, 90) )
    NODEFAULT
ENDIF
much simpler than a case for each non-allowed character, if I understood correctly that's what you were suggesting.

My US$.02 (or less),
Rich Addison, Micro Vane, Inc., Kalamazoo, MI
Relax, don't worry, have a homebrew.
- Charlie Papazian, The New Complete Joy of Home Brewing
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform