Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using a Control (or a container) to validate its content
Message
From
29/04/1997 15:18:00
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00030015
Message ID:
00030170
Views:
37
>>>>>Does anyone have a sure solution to the VALIDATION OF A CONTROL OR CONTAINER?????
>>>>>
>>>>>
>>>>>TIA,
>>>>>Peter

[snip]

>For example I allow the blanking of my date field. If I used the embedded textbox control validation the moment I blanked a month but still had a day and a year the months Valid would return .f. because " /12/1997" is not a valid date. So instead I allow blank month, day, or year and check to see if they are all blank or all filled when focus is lost from the container.

---

If you allow all blanks OR all filled, but not *part* filled, try this:

1) When you enter the form, automatically fill the textboxes with a
reasonable date. (Say, the current date.)
2) If the user *changes* one textbox, do whatever normal validation
you'd want to do (making sure they don't enter 13 for the month, or
whatever)
3) If the user *blanks* a textbox, and then changes focus (as opposed to
blanking the box before typing something new) FORCE a blank of the other
two boxes:
txtmonth.LostFocus:
IF THIS.Value = ""
txtyear.Value = ""
txtday.Value = ""
ENDIF

I realize this doesn't let you attach your validation to the container,
but the only way I can think of doing that would be to create a method
that checks validation, and then call it frequently.

Hope this helps...

--Liz
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform