Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Valid event - how to change default text - Invalid input
Message
From
02/10/2002 09:04:03
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00706765
Message ID:
00706812
Views:
24
You can use the VALID event in this manner and it will not return the default message:

if lastkey() = 27 or :
empty(this.value)

return 1

endif

if (validation code ok)

return 1

else
this.value = ""
messagebox("INVALID INPUT",48,"ATTENTION")
return 0
endif

The above code lets you bypass the validation altogether when the user presses a cancel button or some other control. If the validation does not succeed, you can show your own message, as above. If it succeeds, the next event that fires is LOSTFOCUS. In there you can use a form property to return the .F. value that you need.
Or save data or do whatever else has to be done after the validation took place.

I find the valid method very useful but you need to know how to use it properly.
Rafael Copquin
Treasurer - Microsoft Users Group of Argentina (MUG)
www.mug.org.ar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform