Results 1 to 3 of 3

Thread: Collection within a Collection

  1. #1

    Thread Starter
    Hyperactive Member rjbudz's Avatar
    Join Date
    Jul 2005
    Location
    San Diego
    Posts
    262

    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.

  2. #2
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Collection within a Collection

    Why not just use a database? That is what they are designed for.

  3. #3
    Member
    Join Date
    Dec 2004
    Posts
    49

    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
  •  



Click Here to Expand Forum to Full Width