Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
My VFP Collection not showing up in VB - Why
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00386791
Message ID:
00387155
Views:
20
>>>I have defined a class (olepublic) that uses another class as a collection. The way the other class is embedded is by using the addobject() in the INIT of the first class.
>>
>>I didn't see where you added the object reference to the array property- which is how you would have to access the objects. Adding objects at runtime won't work in a VFP COM object, because the interface isn't defined at compile time, so the client can't know that the object exists. But you can allow the objects to be referenced through a predefined property...
>
>I am not sure I understand this correctly.
>After the init of the PHONES object. I can access the collection by


VFP does not allow the creation of collections. There are several ways to fake it, but the code you posted doesn't do that. Giving an object an array property named "item" won't do it. You can fake a collection by creating an array property of the parent object, and filling the array with references to the children object. IOW, you would create a property of the Phones class called Errors, and initialize it as an array. when an error occurs, add an object to Phones (it has to be a container or Custom object), increment your array, and set the new array value to reference the newly added object. You should then be able to reference the child object through its array reference.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform