Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning a value from a custom method
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00139230
Message ID:
00139246
Vues:
43
Michelle,

To explain why the error happened.

You'll get that error if you don't have the () at the end of the method name otherwise VFP can't from the circumstances it finds the code in know whether you are talking about a method or a property. FWIW I always put () after a method name I just think it's a good habit.

For example:
if ( lSomeCondition )
   this.DoSomething
endif
VFP knows that you have to be talking about a method, it's not syntactically correct to be talking about a property on the this.DoSomething line so it calls the DoSomething method. Inside the IF condition you must use the () to remove the ambiguity:
if ( this.DoSomething() )
   this.DoSomethingElse()
endif
>How do I do the equivalent of "IF thisform.DoSomething() THEN..." where "DoSomething" returns .T. or .F.?
>
>It complains that "DoSomething" is a method, not a property.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform