Information générale
Catégorie:
Gestionnaire d'écran & Écrans
>I have a form in which I test for two items in a certain field:
>
>1. That the user has keyed in 8 characters
>
>2. That the last four characters are "7879"
>
>This is the code in the valid method of the textbox:
>
>** start - Valid method of textbox **
>
>al = len(wires.CUtransit) && create memory variable to
>save to zzz all like al && see what VFP says is the length of expression
>
>
>IF len(this.value)<>8
>=messagebox("Transit Number must be 8 characters [ie. 12347879] !",16,oCUWS.appname)
>else
> if right(this.value,4)<>"7879" and len(this.value) = 8
> =messagebox("Transit Number must end with '7879' !",16,oCUWS.appname)
> endif
>endif
>
>*** end ***
>
>When I enter two characters, the memory variable 'al' returns 8 as the length of the expression. I can't seem tp trap for the user entering less than 8 characters.
>
>Any ideas in what I am doing wrong here?
Instead of len(this.value) try using LEN(ALLTRIM(this.value)) for the valid event.
Also I taking the length of the field would always give you 8.
Dave
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement