Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to pass an array and return array from a form
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00759681
Message ID:
00760181
Vues:
15
Jim,

I tried your suggestion and received an error 'loParam not an object' when I attempted to reference it upon return to the calling program.

However, if I define a class in my 'set procedure' program and add the object in the calling program based upon that class, I do not get the error. Also, in this case I didn't use the 'return thisform.loParam' in the called program.

I really appreciate all of the suggestions in this thread.
Thanks once again.
>>Jim,
>>
>>That wouldn't work with local variables would it?
>>I would have to use private?
>>Tks.
>>
>
>Alan,
>
>Passing by reference and variable scoping are tow different things. You could create a private array prior to calling your form and then address that array in the form, but that presents a whole mediad of potential problems.
>
>By far, the best solution ot your probelm is to use a parameter object;
>
>
>
>loParm = CreateObject("Relation")
>loParm.AddProperty("MyArray(1,2)")
>DIMENSION loParm.MyArray(2,3)
>
>FOR lnCnt1 = 1 TO 2
>   FOR lnCnt2 = 1 TO 3
>      loParm.MayArray(lnCnt1,lnCnt2) = SUBSTR("ABC",LnCnt2,1)
>   ENDFOR
>ENDFOR
>
>* For this to work the form must be modal becasue only m odal form's can return values
>DO MyForm WITH loParm TO loParm
>
>* Now loParm has a property named MyArray that has whatever the fomr put there for values.
>
>
>In the form's code;
>
>
>PROCEDURE Init
>  LPARAMETERS poParms
>  Thisform.AddProperty("MyParms")
>  Thisform.MyParms = poParms
>ENDPROC
>
>
>Then within the form you use Thisform.MyParms.MyArray(x,y)
>
>
>PROCEDURE Unload
>RETURN ThisForm.MyParms
>
Regards,

Allan Coganovitch
allanc@proven-solutions.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform