That works! Thanks Agnes. Rick S gave me the same advice. It makes for a lot of code (I have to traverse a lot of collections and arrays in one object), but it gets the job done. :o)
>Hi Tracy,
>
>sometimes VFP seems to have problems such collections.
>
>If I run into a problem like this I try to decompose the object to a closer var like
>
>loTemp = arg.callscript.scriptmodules.item(0)
>loTemp = loTemp.questions.item[0]
>loTemp = loTemp.answers[0]
>?lotemp
>
>
>Note that it needs each step
>
>HTH
>Agnes
>>I have an array as a property of an object. The object is passed from a COM dll. I create an object to hold the passed object using:
>>
>>PUBLIC loQuestion AS comdll.TRQuestionClass
>>
>>now loQuestion has two properties:
>>
>>1) Question - type = 'C', value = 'Question 1'
>>2) Answers - type = 'Z', value = 'Array'
>>
>>What is a type of 'Z' ? that shows in VFP in the debugger.
>>
>>The passed object is an arg of variant type. One of it's properties is a collection that contains a string and an array in each item. The questions collection property in the passed arg matches the loQuestion object I created. So it should be the same (2 properties that match my loQuestion object) and it does. It has:
>>
>>arg.callscript.scriptmodules.item(0).questions.item[0]
>>
>>Now that object (questions.item[0] in the scriptmodules collection) returns:
>>
>>
>>TYPE("arg.callscript.scriptmodules.item(0).questions.item[0]") = "O"
>>
>>The above is a single question object in the questions collection with an array of matching answers that matches my loQuestion object.
>>There should be:
>>
>>arg.callscript.scriptmodules.item(0).questions.item[0].question
>>arg.callscript.scriptmodules.item[0].questions.item[0].answers
>>
>>The answers array exists because:
>>
>>TYPE("arg.callscript.scriptmodules.item(0).questions.item[0].answers") = "A"
>>ALEN(arg.callscript.scriptmodules.item(0).questions.item[0].answers,1) = 1
>>
>>However, if I try to copy the array over to loquestion.answers, it bombs:
>>
>>=ACOPY(arg.callscript.scriptmodules.item(0).questions.item[0].answers,loQuestion.Answers)
>>
>>and:
>>
>>FOR it = 1 TO ALEN(arg.callscript.scriptmodules.item(0).questions.item[0].answers,1) -1
>> ? it
>>ENDFOR
>>
>>However,
>>
>>FOR it = 1 TO ALEN(arg.callscript.scriptmodules.item(0).questions.item[0].answers,1) -1
>> ? arg.callscript.scriptmodules.item(0).questions.item[0].answers[it]
>>ENDFOR
>>
>>So I cannot step throught the elements to copy it to the loQuestion.Answers array either.
>>
>>Same error if I just:
>>
>> ? arg.callscript.scriptmodules.item(0).questions.item[0].answers[0]
>>
>>
>>I know it's an array, but passed property seems to be an array I cannot access the elements of and in vfp the object type I create to hold it it is of type 'Z' with a value of 'Array'
>>
>>In the .net dll it's defined as:
>>
>>TRQuestionClass
>>
>>public string[] Answers {get;set;}
>>public string Question {get;set;]
>>
>>
>>How do I work with that? I don't understand why the array can't be accessed.
>>
>>I am working with lots of passed objects in other events and collections and strings all work fine, but arrays seem to be a problem for some reason.
.·*´¨)
.·`TCH
(..·*
010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"