Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning value from a Method
Message
De
05/02/2007 20:47:03
 
 
À
05/02/2007 18:09:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01192623
Message ID:
01192639
Vues:
16
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform