|
-
Mar 14th, 2007, 05:07 PM
#1
Thread Starter
Hyperactive Member
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.
-
Mar 15th, 2007, 12:16 AM
#2
Re: Collection within a Collection
Why not just use a database? That is what they are designed for.
-
Mar 15th, 2007, 04:40 AM
#3
Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|