Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
AFIELDS() array not properly added by AddProperty
Message
From
02/03/2000 13:46:04
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Title:
AFIELDS() array not properly added by AddProperty
Miscellaneous
Thread ID:
00340727
Message ID:
00340727
Views:
76
How can I add the resulting array of AFIELDS() as a property of an object during runtime?

I've followed the sample in the help file of VFP and it worked. The code following the sample does not.
**********
* visual foxpro help sample that works well
oMyForm = CREATEOBJECT('Form')
oMyForm.AddProperty('MyArray(2)', 1) && Add an array as a property
oMyForm.MyArray(2) = 'Two'
*CLEAR
? oMyForm.MyArray(1) && Displays 1
? oMyForm.MyArray(2) && Displays Two

*********
* my code
create table myTable (fld1 c(10), fld2 c(10))
afields(myAliasArray,'myTable')
use in myTable
for i=1 to alen(myAliasArray,1)
? myAliasArray(i,1) && prints okay
endfor
nFlds =alen(myAliasArray,1)
cProp ='myAliasArray(nFlds,16)'
oMyForm = CREATEOBJECT('Form')
oMyForm.AddProperty(cProp)
for i=1 to alen(oMyForm.myAliasArray,1)
? myAliasArray(i,1)
?? oMyForm.myAliasArray(i,1) && has a value of .F. ???
endfor
ramil
~~ learning to stand still
Next
Reply
Map
View

Click here to load this message in the networking platform