Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Working of if command
Message
De
06/05/2007 15:13:33
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01222882
Message ID:
01222906
Vues:
22
The indenting does not match the way Visual FoxPro would read the program. Try to use the "Beautify" option; this will tell you how VFP interprets the code. Specifically, the second IF is within the first IF; the indenting seems to indicate that you expect it to be two separate IF structures. Correcting the indentation, it would look something like this:

>When i run these codes, only work first if, I think not read scond if
>
if thisform.text1.value=="123" or Alltrim(thisform.feeuser.value)=="khubaib"
      feeuser=thisform.feeuser.value
  Do Form frsptc
    thisform.release

Else
  = Messagebox('not allowed', 32, product)
  thisform.release
  Return .T.


  if ALLTRIM(thisform.text1.value)=="123" or Alltrim(thisform.feeuser.value)=="abid"
     feeuser=thisform.feeuser.value
    Do Form frsptc
    thisform.release
...
  Else
     = Messagebox('not true', 32, product)
     thisform.release
     Return .T.
  ENDIF
ENDIF
Rules for indentation:
  • if, else, endif, should be at the same column.
  • Everything between if-else, and between else-endif, should be indented one level.
  • In Visual FoxPro, ALWAYS use tabs, not spaces, for indentation.
  • If your program indentation is too messed up, you can fix it (more or less) with the "Beautify" option.
    Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
  • Précédent
    Répondre
    Fil
    Voir

    Click here to load this message in the networking platform