Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Remind me how, please?
Message
 
À
27/10/2008 13:49:27
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01357393
Message ID:
01357457
Vues:
19
I agree with this approach instead of using LostFocus or Valid. Another big advantage for me is being able to "read through" my error trapping in one location to be sure I haven't overlooked a case. That is a pain with individual error checking...

Instead of a simple return, though (which will take you back to the OK/Save button) I set focus back to the error-causing object.


>>Got a date range, and if the Beginning Date is empty, but the user puts a something in the End Date, I need to display an error message and put the focus back in the Beginning date.
>>
>>So, someone please remind me how to do that?
>>
>>Thanks
>
>SetFocus() method might work. But personally, I prefer a different approach: Postpone all validation. Only when the data is saved (or when the user presses an "OK" button to fire some other action, such as printing a report), should you run some code that does all the required checks. Just tell the user what is missing, and let the user complete the missing information, something like this:
>
>
>do case
>case empty(ldDate1)
>  ErrorMessage('You need a "from" date.')
>  return
>case empty(ldDate2)
>  ErrorMessage('You need a "to" date.')
>  return
>case ldDate1 > ldDate2
>  ErrorMessage("The second date must be equal to, or after, the first date.")
>  return
>endcase
>
>* Processing continues here
>
>
>I am assuming a UDF called ErrorMessage().
>
>The advantages of this approach are several. For one, the user can input data in any order. Two, programming the entire validation is fairly straightforward, and you can easily introduce conditions that span more than one field (such as the last CASE in my example).
Phil Thomas
http://phillipdthomas.com

Never let your energy or enthusiasm be dampened by the discouragements that must inevitably come.....
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform