Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validating Entries In A TextBox
Message
 
To
17/10/2001 11:43:35
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00569648
Message ID:
00569876
Views:
17
>To All:
>Please recommend ways of checking a TextBox to see if it is empty or also that it contains only Alpha characters. The code should then post a MessageBox telling the operator that the field cannot be blank or some character is invalid. Then the cursor should return to the same field to allow correction of the problem. I tried using the Valid event but it pops a nasty little wait window that I would rather not see. I will use this code to check each Textbox on the form.

Eric;

Another thought: Required fields can use a highlighted background, as a visual aid to users. Additionally, there are a number of ways to do validations, depending upon requirements and design. Validation at the object level as you described can be a time saver to the user as opposed to putting validation code in only the Save method.

There is nothing a user hates more than "completing data entry into a form" and attempting to save his/her work, only to be told upon hitting the Save Button, "Hay Charlie, you forgot something - fill in the required data". After receiving a few such messages users get upset! However, the Save method will still have to check for your business rules. So you may end up with code in both places.

Creating a textbox class with the required methods supporting what you want to do is a good way to go. It would take care of the Alpha character Formatting, background color (if you wish to use this visual aid) and code. My first framework incorporated textboxes for numeric, alpha, date, zip code, and telephone number formatting, to name a few.


Tom
Previous
Reply
Map
View

Click here to load this message in the networking platform