Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validating a textbox field
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Validating a textbox field
Miscellaneous
Thread ID:
00067407
Message ID:
00067407
Views:
54
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?
Al Williams

Anola MB, CANADA
Next
Reply
Map
View

Click here to load this message in the networking platform