Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Forcing users to enter four digit years
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00194116
Message ID:
00194129
Views:
24
>I'm trying to create a date class (VFP 5.0) text box that forces a user to to enter a four digit year. I thought it was going to be a piece of cake and I will knock one out in no time. I have found that I cannot trap the number of digits the user keyed in in the *valid* because FoxPro will automatically force it to 8 digits. If I try to trap it in the *keypress* I run into other problems. What if the user pressed *delete* or *backspace*? What if the user pressed *delete* or *backspace* with no text in the text box?
>
>Has anyone invented the wheel?
could you do something like :
dash2 = RAT( '/', pcharval ) && find last / use dtoc()
lyrstr = SUBSTR( pcharval, ( dash2 + 1 ) ) && go to the character after last /
IF NOT ISDIGIT( lyrstr ) ;
OR NOT ISDIGIT( SUBSTR( lyrstr, 2, 1 ) ) ;
OR NOT ISDIGIT( SUBSTR( lyrstr, 3, 1 ) ) ;
OR NOT ISDIGIT( SUBSTR( lyrstr, 4, 1 ) ) && check next 4 char to make sure they are #'s
RETURN {}
ENDIF
Previous
Reply
Map
View

Click here to load this message in the networking platform