I use the LostFocus Event.
The reason is that certain validation rules
may require the use of a dialog box. If the dialog box uses SetFocus(), an error will occur - you cannot use SetFocus() when called from the Valid Event even if the Valid Event instantiates a form which uses it. You also gain more control over WAIT WINDOW messages, because FoxPro has it's own funky WAIT messages when Valid() returns false.
If you put your validation code in the LostFocus Event, you can use SetFocus() in a called dialog. If the validation fails (e.g. returns .F.), issuing This.SetFocus() in the LostFocus Event returns focus to the control. If I rememeber correctly, NODEFAULT does not return focus in the LostFocus Event.
>For data validation or certain rules validation, do you code in LostFocus() or The Valid() event ? Why do you choose one over another ? Does it offers any superior functionality ?
- Jeff