> why don't you mix the two; you may create a collection class, that is
> a class which internally holds a collection of classes, the latter
> will expose the get/let/set properties you need (match them with the
If you want to quick try it, fire up your VB6 IDE and create a new,
empty project, next go to the "add-ins" menu and open the "class
builder utility", right click on the left pane node and select "new"
and "class", name the new class "CDataItem" and confirm, you'll see the
new class in the class builder, select the class and right click on the
"properties tab" in the right pane, add a string property and call it
"ItemKey", then, go on adding whatever properties you want (you may
match your UDT if you want); once you have all your properties, select
the "methods" tab (right pane) and add two methods, that is a
"Serialize" one w/o parameters and returning a variant and a
"Deserialize" one accepting a single variant parameter and returning a
boolean value
Now it's time to create the collection; click on the left hand pane
root node and select "new" and "collection", call the collection
"CDataItems", leave the "based on" empty and select the "CDataItem"
entry in the "collection of" list, confirm and you'll have your
collection class, now add to it two methods, again "Serialize" and
"Deserialize" matching the ones you added to the "CDataItem" class
At this point, just go to the file menu, select "update project" and
close the class builder; now your project will contain two classes, the
"CDataItem" used to store the single items and the "CDataItems" one
which contains a collection of all your items; the next steps will be
changing the "Add" method of "CDataItems" to use the "ItemKey" as the
collection key (easy) and adding code inside the serialize/deserialize
methods of both the CDataItem and CDataItems; the first will contain
code to pick the various values of the item and turn them into (say) a
string or stuff them inside a propertybag and returning it (the
opposite for the deserialize, pick the "blurb", extract the values and
assign them to the internal values), the second (CDataItems) will
either loop through the CDataItem collection, call the "serialize"
method for each element and add the returned "blurb" to some kind of
buffer/array/propertybag/... or will pick the buffer containing the
serialized data, loop through it and for each element create a new
instance of CDataItem add it to the collection and call its deserialize
method to populate it
HTH