Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to pass a whole array to class?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00018304
Message ID:
00018318
Views:
33
>It may be a silly question.
>Could any one let me how to pass a whole array (not the elements of array) to class? I only can pass the first element to class. Is there something I missed?
>
>Sunny

Hi sunny,
you have to pass the array by 'reference', otherwise you only
get the first element, you can do that in two ways, either you
use the '@' sign or set your 'UDFPARMS' to reference before
calling your form or class, the first way will be:


m.old_udfparms=SET('UDFPARMS') && Save previous settings

SET UDFPARMS TO REFERENCE
DO FORM my_form WITH my_array

SET UDFPARMS TO &old_udfparms && Restore previous setings


and the second one would be:
oMy_class=CREATEOBJECT('my_form',@my_array) && Note the '@' sign

P.S. I personally prefer the second one, because with the first
one if you forgot to restore the UDFPARMS to 'VALUE' you can
have problems with some 'DLLs', and also is a good idea to
store the array in a property as soon as you receive them in
the form, because the scope of the parameters doesn't go
beyond the init event of the form or class.

hope this help.
Luis Guzman, MCP
"The only glory most of us have to hope for
is the glory of being normal." Katherine Fulleton Gerould
Previous
Reply
Map
View

Click here to load this message in the networking platform