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:
00760072
Vues:
18
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform