Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Return Multiple Values From a UDF
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
00979276
Message ID:
00979283
Vues:
12
You can return an instance of an object.
DEFINE CLASS ReturnClass AS Line
ReturnVallue1 AS String
ReturnVallue2 AS String
ENDDEFINE

FUNCTION MyUDF

LOCAL loReturn
loReturn = NEWOBJECT ("ReturnClass")
...
loReturn.ReturnValue1 = "ABC"
loReturn.ReturnValue1 = "DEF"
RETURN loReturn

PROCEDURE Main

LOCAL loReturn
loReturn = MyUDF ()
? loReturn.ReturnValue1
? loReturn.ReturnValue2
loReturn = NULL   && Don't forget to clear the reference to the instance of the class
RETURN
HTH

>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. I have thought about casting and concatenating the values to a single string then returning that and parsing it when needed but I know there has to be a 'cleaner' way to accomplish this.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform