Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Collection of Objects vs Datatable

10 views
Skip to first unread message

Alex

unread,
Feb 29, 2008, 12:14:28 PM2/29/08
to
Hi,

I'm trying to find the best way to store multiple pieces of data
within an object, and i'd like some suggestions from folks with abit
more VB and/or OOP experience then I.

One part of the program I'm writing will have a class containing an
inventory list of all items under a specific ID, and I need some way
to easily pass this inventory list around my application.

My first thought was to create an Inventory class with all the details
of each individual item, then a second class that would create a
collection of Inventory objects where using functions I could pass the
complete collection to my application as a whole, or pass a specific
Inventory object by key to the application or vice versa. Each
Inventory object could be called individually by key, but to put this
back into a datagrid would require a series of loops to pull the
Inventory data from the collection then Inventory object.

A second approach is bypassing a collection all together and using a
datatable where all inventory information is pulled from the database
via a SP and stored in a datatable, then using custom dataviews
filtered with 'RowFilter' pass enter specific information to the
application or pass the entire datatable to the application as needed.

Some instances might have a few dozen items in the Inventory and some
might have 1000 or more... so I'm not sure how best to do this. I'm
thinking keeping this in a datatable would be best since it's more
dynamic and can be more easily passed to a datagrid, but I can see the
advantages of a collection of objects as well.

Any thoughts? Any completely other approaches on how to accomplish
this? Also, this is all being done using winforms in Visual Basic
2005.

Thanks or your time, and take care ,

Alex

0 new messages