Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need Class Collection advice
I have been thinking of various ways to populate my collection classes
with its children. 1) I could create the .Add function of the collection class to accept a child object as an argument, which then adds the child to the collection. 2) I could create the .Add function of the collection class to not accept any arguments, and to just return a new child object I do not know when one method would be preferred over the other. Can anyone help? Thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need Class Collection advice
I would definitely go with approach #1, if for no other reason is
than it would make your collection class work more like a regular collection object. I don't see what advantage there would be to using approach #2. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "R Avery" wrote in message ... I have been thinking of various ways to populate my collection classes with its children. 1) I could create the .Add function of the collection class to accept a child object as an argument, which then adds the child to the collection. 2) I could create the .Add function of the collection class to not accept any arguments, and to just return a new child object I do not know when one method would be preferred over the other. Can anyone help? Thanks! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need Class Collection advice
Alright! Just needed advice from a pro. ;D Thanks.
|
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need Class Collection advice
I disagree, I'd go for
3) create the .Add function of the collection class to accept any arguments required to create a child object and return the new child object to make it work more like a regular collection *class*. For example, Set ws = ThisWorkbook.Worksheets.Add(1) For me, adding a child object directly to the collection is usually a Private/Friend method of my object hierarchy i.e. not a Public method exposed to the client. -- "Chip Pearson" wrote in message ... I would definitely go with approach #1, if for no other reason is than it would make your collection class work more like a regular collection object. I don't see what advantage there would be to using approach #2. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "R Avery" wrote in message ... I have been thinking of various ways to populate my collection classes with its children. 1) I could create the .Add function of the collection class to accept a child object as an argument, which then adds the child to the collection. 2) I could create the .Add function of the collection class to not accept any arguments, and to just return a new child object I do not know when one method would be preferred over the other. Can anyone help? Thanks! -- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
pls advice | Excel Worksheet Functions | |||
Using a collection class to implement mutliple find/replace strings in cells | Excel Programming | |||
Collection Class problems | Excel Programming | |||
RaiseEvent from a class contained in a 2nd class collection? | Excel Programming | |||
For/Each iteration for collection class | Excel Programming |