Collection within a Collection
I want to create a class with several instances (a collection), to hold transaction information. Say an order number, sales date, customer name, etc. Now, within that class instance, I want the items purchased on this order: Beer, cigarettes, condoms, whatever.
Plus there will be more orders too. Say chocolate, roses and diapers.
How do I create the order collections that hold my items collections? And how do I add items & access individual items within the independent orders?
If Betty Lou comes in wanting to know if Stanley was buying condoms on the day he bought her roses, how would I figure it out (telling her is beyond the scope of this exercise, of course)?
I’ve tried several ways using the Class Wizard in VB6, but got all turned around.
Re: Collection within a Collection
Why not just use a database? That is what they are designed for.
Re: Collection within a Collection
The way to do this is to use a collection for orders and in the order class add the collection Items which contains the instances of the item class.
So the order would be something like this :
Items AS Collection (or Items if you have a collection class)
OrderNr AS string
SalesDate AS Date