Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
If, then, else
Message
De
11/03/1997 16:14:07
Paul Wei
Fib, State of Michigan
Lansing, Michigan, États-Unis
 
 
À
11/03/1997 15:35:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00023771
Message ID:
00023785
Vues:
35
>>>Watching this code in the debugger reveals that even when seek evaluates to false, the else clause in not executed. Am I forgetting something? I have had this problem before and band-ais fixed it with separate 'if' statements.
>>>
>>>if seek(my_name) = .T. then
>>> if passwords.password = my_password then
>>> messagebox(greeting, 0,"Log")
>>> do login
>>> thisform.release
>>> endif
>>>else messagebox("Invalid Login Attempt", 0, "Invalid")
>>>endif
>>
>>Is this VB or VFP? In VFP we don't use Then and Else should be different:
>>IF logic_expr
>> do something
>>ELSE
>> =messagebox()
>>ENDIF
>
>I like to use Then for clarity (VFP allows it) and I don't believe it matters if the else command is on the same line as the else statement (I have tried it both ways). The debugger shows that the program never even looks at the else statement. I have had this problem before on very simple If statements. Is there anything else I could be doing wrong?

What everone is trying to tell you is that if you want the "messagebox()" function following the "ELSE" to execute, it must be in it's own line. It can't be on the same line as the "ELSE".

Paul
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform