Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Forcing users to enter four digit years
Message
De
04/03/1999 14:01:57
 
 
À
04/03/1999 13:32:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00194116
Message ID:
00194129
Vues:
25
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform