Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning a value from a custom method
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00139230
Message ID:
00139246
Views:
44
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform