Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Click or keypress
Message
De
09/02/2006 08:12:31
 
 
À
09/02/2006 07:57:35
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 8
Database:
Visual FoxPro
Divers
Thread ID:
01094948
Message ID:
01094955
Vues:
10
>>any new way to write this code under , and at click or keypres is better
>
>IF thisform.text2.value=ALLTRIM("Residential") AND thisform.text1.Value <   1    OR thisform.text1.Value>5
>        =MESSAGEBOX("out of range")
>            thisform.text1.SetFocus
>ENDIF
>IF thisform.text2.value=ALLTRIM("Business") AND thisform.text1.Value < 1 OR     thisform.text1.Value>4
>       =MESSAGEBOX("out of range")
>     thisform.text1.SetFocus
>ENDIF
>
>thanks.


Normally you do that in the Valid() method. Or as a last resort in LostFocus().

If ThisForm.Text1 only gets a simple number with a range of 2-4 why don't you change it to a Spinner control setting the Min and Max properties to 2 and 4?

Also when mixing AND and OR comparisons in the same line you have to use parenthesis:
IF a AND (b or c)
else you'll get incorrect results.

As an aside, it is generally better (more self-documenting) to change the name of the controls to something meaningful instead of "text1" and "text2". Makes you program easier to read and understand.


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform