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:
00759708
Views:
19
This message has been marked as the solution to the initial question of the thread.
DO FORM (some form) with laArrayVariable.

The array will be passed to the INIT of the form. From there, you will have to manage the values from there... If you change a value within, it will retain, but not sure about the remainder of the process. This PROBABLY will NOT do what you are intending...

Another quick and easy way is to pass an Object reference that has an array element to it... Then you can store the object reference to a custom property of the form, update that object array elements directly, then when the form closes, the values will be available back to the first form. (just be sure to clear the property reference on the second form, or the second form won't release).

You may want to create a simple class such as
DEFINE MyArrayClass as Custom
   dimension gaMyArray[1,1]
   dimension gaOtherArray[1,1]
ENDDEFINE

*/ Then, in your form that will INVOKE the call...

loMyObj = createobject( "MyArrayClass" )
dimension loMyObj.gaMyArray[5,2]
loMyObj.gaMyArray[1,1] = "something"
.
.
.

do form (some form) with loMyObj
Then, in the INIT event of the form BEING CALLED...
lparameters loExpectingObject

Thisform.AddPropery( "ObjectFromOtherForm" )

Thisform.ObjectFromOtherForm = loExpectingObject
Then, within the code you want to manipulate the "array" with, you would do something like...

(ex: in a click event or change event of a control on the form...)
WITH Thisform.ObjectFromOtherForm
   .gaMyArray[1,1] = "changed value in array"
   dimension .gaOtherArray[2,3]
   .gaOtherArray[1,1] = "whatever"
   ...
ENDWITH
Remember to release the object reference before the form is destroyed...
Thisform.ObjectFromOtherForm = NULL
Thisform.Release()


HTH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform