Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do you pass an array to a Form Class Init method?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00054387
Message ID:
00054437
Vues:
36
>Anyone know how to do this?
>I can do the following
> do form frmTest with aArray
>But if I try it with a class, VFP returns error
>saying it is not an array.
> obj = crea('frmTestClass', aArray)
>Is there a way to get around?
Kevin,

You need to pass the array by reference as in;

obj = CreateObject("frmTestClass", @aArray )

the way you are doing it is passing only the first element of the array as a value. The reason that the DO FORM syntax is workling for you is that the DO ... WITH command passes parameters by reference by default and the function calling syntax CreateObject() passes parameters by value by default. The @ symbol in front of the parameter forces pass by reference on that parameter.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform