Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MessageBox in a loop!!!!
Message
De
18/10/2001 10:10:55
 
 
À
18/10/2001 01:37:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00570063
Message ID:
00570226
Vues:
19
>>Hi Everyone,
>>
>>Can someone please tell me why in the code below the MessageBox gets caught in a continuous loop. This code is being called in the Valid event of a TextBox. Surely, I'm missing something.
>
>If you're always returning 0 at the end, the control will never lose focus. You might want to restructure your logic as outlined below:
>
******************
>local lnanswer, <b>lnRetVal</b>
>
>If Empty(This.value)
>  lnanswer=messagebox("First Name field cannot be blank",1,"Text Entry Error.")
>
>  If lnanswer = 2 && If the Cancel button is clicked back out of the record.
>    =Tablerevert()
>    Thisform.flipenable
>    Thisform.Refresh
>
>    <b>lnRetVal = 1  && proceed to next control
>
>  Else
>    * User wants to try again:
>    lnRetVal = 0</b>
>   		
>  Endif
>
><b>Else
>  * Name not empty, this is OK, allow loss of focus:
>  lnRetVal = 1</b>
>
>Endif
>
>Return <b>lnRetVal</b>
>******************
It's one of my personal cardinal rules, to never use an IF statement without an ELSE - even if there's nothing to do, it encourages you to consider the flip side of the logic.

#############
Thanks Al,

I appreciate the tip. I am slowly molding the coding concepts together.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform