Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validing Keystrokes in an Input field
Message
From
13/01/2000 10:05:02
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00317341
Message ID:
00317591
Views:
13
SECOND TRY. Forgot to send copy to Mathias. Mea culpa.

Mathias (via Jim's post)-

>>Valid Characters are in are "ABCD12340.()+"
>Mathias,
>
>In the KeyPress put this code;
>
>
IF NOT CHR(nKeyCode) $ "ABCD!@#$).()+"
>   ?CHR(7)   && Beep
>   NODEFAULT && Ignore key stroke
>ENDIF
>
One nice thing about going this route, rather than using INLIST() is that it's more flexible for future changes (IMO).

IOW, you might want to consider storing the valid character string in, perhaps, a form property or even a field in an appliction options table so that if you need to change the string, it's easy. Also, so that if you need access to it in more than one place, you have it available throughout your code without having to remember what it is.

A #DEFINE would also be an approach.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform