General information
Category:
Coding, syntax & commands
>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only