Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validate entry
Message
From
01/09/2011 07:17:37
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
01/09/2011 05:36:28
Muthu Vel
Sty Company
India
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01522437
Message ID:
01522441
Views:
61
>In my Test.scx i placed one text box namely txtbasic, user want to enter only numeric value so i set format property "9" so user can not enter any character on the text box. Instead of this i want alternate method, when user try to enter any character on the text box the message box pop up and tell "Hey It is not Numeric"
>
>how to do this?

A better option - in most cases - is to make the database field numeric. In any case, what would be the advantage of your "alternate method"?

Validation in this case is somewhat complicated; you could do a transformation in which you take out all digits and periods (for the decimal point) as well as hyphen (for minus), and see if there is anything left (there shouldn't). Additional check are required, for example: there should be only minus sign, and it should be the leftmost character; and there should be either zero or one points. - It is easier, and usually better, to let Visual FoxPro do this validation, for example with the numeric InputMask.

You could also just convert to numeric with the val() function. In this case, the first non-numeric character, and anything after that, will be discarded - but you get no error message.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform