Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing arrays to forms
Message
De
19/08/2003 10:42:33
 
 
À
19/08/2003 10:29:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00821385
Message ID:
00821415
Vues:
23
Well, Denis, when you're right, you're right. Passing an array to a form works properly without the reference indicator, and gives a syntax error with it (VFP8)

I just tested it. Form called 'arraytest.scx', prg called 'arraytest.prg'

In the form's init:
LPARAMETERS taArray
LOCAL lnCount, lcString
lcString = ""

FOR lnCount = 1 TO ALEN(taArray)
   lcString = lcString + taArray[lnCount] + CHR(13) + CHR(10)
ENDFOR

MESSAGEBOX(lcString)
And the prg is:
LOCAL Array laStrings[4]
laStrings[1] = "passing"
laStrings[2] = "arrays"
laStrings[3] = "to"
laStrings[4] = "forms"

DO FORM arraytest WITH laStrings
Works perfectly. If I change last line to "DO FORM arraytest with @laStrings", I get a syntax error

Alan


>Hi Alan,
>The form is not API or vfp function. I am guess about possible to pass parameter to the form as "@a". Did you try? Foxpro have SET UDFPARMS TO VALUE(REFERENCE). Maybe this way.. but I do't know how possible to use WITH @a in DO FORM. Am I right?
>
>Denis
>
>
>
>>As I understand it, if you don't pass it by reference, only the 1st element gets passed, and that's not an array.
>>
>>Alan
>>
>>>Privet Sergey,
>>>I am not sure about you are right with "@a" ... on my opinion Pablo's code must work as is.. and problem is not in parameter and WITH..
>>>Denis
>>>
>>>
>>>>You have to pass array by reference.
DO FORM c:\fuentes\six\articulos\form\ABMSIMPLE WITH @a
>>>>>I have,
>>>>>
>>>>>DIME a(3)
>>>>>a(1)="qwe"
>>>>>a(2)="4rwe"
>>>>>a(3)="qwwere"
>>>>>
>>>>>DO FORM c:\fuentes\six\articulos\form\ABMSIMPLE WITH a
>>>>>
>>>>>and in the INIT on the FORM,
>>>>>
>>>>>LPARAMETERS tcTablas
>>>>>
>>>>>then why I dont get an tcTablas as an array? I only get one value.
>>>>>
>>>>>thanks!
>>>>>Pablo
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform