Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning value from a Method
Message
From
05/02/2007 20:47:03
 
 
To
05/02/2007 18:09:32
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01192623
Message ID:
01192639
Views:
17
>Question: can I return a value from a Method? If so, how would I reference the returned value?

Several ways to return a value -- if only single value, then you can use the method by Dan Freeman. You can pass the parameters to the method by reference:
MyVar1 = ""
MyVar2 = 0
thisform.MyMethod(@MyVar1, @MyVar2, ...)
...
? MyVar1
? MyVar2
the @ sign passes the parameter by reference, any value assignment in the method is returned to the calling program. You can also pass an object with properties:
loReturn = CREATEOBJECT("Empty")
ADDPROPERTY(loReturn,"MyVar1","")     && Return value 1
ADDPROPERTY(loReturn,"MyVar2",0)      && Return value 2
thisform.MyMethod(loReturn)
...
? loReturn.MyVar1
? loReturn.MyVar2
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform