Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning variables to the calling program?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00389878
Message ID:
00390057
Vues:
7
>Can someone give me an example of how to pass variables back to the the calling program. I can pass variables to the program with do with command and LPARAMETERS in the called program. But when I use the return command with the variable in it my program that it returns to doesn't see the variables. Does the next statment after the do command have to have Lparameters in it?
>
> Kelly

Kelly,

You could create an object that is passed into the form, has various properties set (your return values), and when the form goes out of scope, there's your object with set properties to carry on what you need.

PROCEDURE SomeProc
LOCAL loSomeObject

loSomeObject = NEWOBJECT(...)
DO FORM SomeForm WITH loSomeObject

**** Init of SomeForm
LPARAMETERS roSomeObject

**** Form has property to hold reference
THISFORM.oSomeObject = roSomeObject

**** In other methods of your form, set the properties needed as return values.
THISFORM.oSomeObject.nSomeNumber = 12
THISFORM.oSomeObject.cSomeCharacter = "Kelly"

**** In the forms .Destroy event, make sure to set oSomeObject to .NULL.

Once the form is released, your instance of loSomeObject should have the values in it's properties that you need.

Kinda convoluted, but works when a sizeable amount of info is needed from a form which can only return one value in the DO FORM xxx TO yyy command.

Steve
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform