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:
00387866
Views:
13
>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:
I think I do what you suggest. The errors class has a property called ITEM which is an array. I fill the array Item with refrences to the ERROR class. The error class has only one property called message. Now in the main object namely PHONES I do an ADDOBJECT of the type ERRORS. This way I can allow the user to refer to the errors by
oPhones.Errors.Item(1).Message
So the behaviour is like a collection. It works fine in VFP but the ADDed OBJECT "ERRORS" is not visible to VB.
Anyway, taking your avice I created a property in the PHONES class and after I do ADDOBJECT in the INIT I populate the property to point to the collection. The net effect is that now I can see it in VB. I have to test it a bit furthur to see if it works correctly. (This is like a back burner kind of project and so th delay :-( )
Mohinder
Previous
Reply
Map
View

Click here to load this message in the networking platform