Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to pass an array and return array from a form
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00759681
Message ID:
00760107
Views:
17
Hi Jim,

I do not think you need to even "return" a value because the for is working with an object reference, therefore the object which is passed to the form is the same object the form is modifying. Upon exiting the form the original object will represent the activities applied by the form.

Glenn

>>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
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform