Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return Multiple Values From a UDF
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
00979276
Message ID:
00979284
Views:
12
Hi Woody.

>IS there a way in VFP to return multiple values from a User Defined Function? I don't want to use an Array, then I have to pass by reference and I am trying to avoid that.

Pass an object. The UDF can then set whatever properties it wants and the caller can then examine the values of these properties. You can even create the object on the fly:
loParameters = createobject('Empty')
addproperty(loParameters, 'ReturnValue1', '')
addproperty(loParameters, 'ReturnValue2', 0)
do MyUDF with loParameters
? loParameters.ReturnValue1
? loParameters.ReturnValue2

function MyUDF(toParameters)
toParameters.ReturnValue1 = 'Howdy'
toParameters.ReturnValue2 = 5
return
Doug
Previous
Reply
Map
View

Click here to load this message in the networking platform