Persisting a Collection of a Collection
Author |
Message |
ME #1 / 21
|
 Persisting a Collection of a Collection
Ok here is the question: I am creating an activex Grid control that will automatically include a combo box in the cell with a list of items. I want to add the ability to create lists for the combo box (per column lists for the time being) and bind the lists to the control. I decided to create a class (dataitem.cls) that will hold just the "itemdata" and the "value" for each item in list. (this is the ITEM) Then I created a collection class based on the the dataitem class (dataitemS.cls). (This is the LIST) Now because the grid will have multiple columns I added another collection class based on the dataitemS class (moredataitems.cls). For each column that will have a combo a collection is created and linked to that column. (These are the COLUMNS) The moredataitems collection is the only collection I had to build into the Control. The problem is I would like to add the data items to the control at DESIGN time. This will require some form of collection persitance, yet I can not, for the life of me, find any instructions on how to persist arrays or collections. I have thought about using an external file to do the trick, but then I would have to always include that file in my source if I wanted to transport the code to another box or I would lose the all the items. Does ANYONE know how to persist a collection in this manner is such a way that you do not have to create an external file to keep track of? I would prefer if there was a way to write the property data the same way any other control property is stored in the form file. Matt Below is a sample idea I have tried but with out success (Generates run-time error '713', class not registered, looking for object with classID: {x-x-x-x-x} error when I attempt to re-open the form with the new grid control) NOTE: The persistable property of each class object is set to true, multi-use.: '----------------------------- CONTROL ------------------------ Private Sub UserControl_ReadProperties(PropBag As PropertyBag) Dim I As Long dim Tmp as object mvarDataItemsCount = PropBag.ReadProperty("MoreDataItemsCount", 0) For I = 1 To mvarDataItemsCount Set Tmp = PropBag.ReadProperty("MoreDataItem" & Trim(Str(I))) Next I End Sub Private Sub UserControl_WriteProperties(PropBag As PropertyBag) Dim I As Long mvarDataItemsCount = mvarMoreDataItems.Count PropBag.WriteProperty "MoreDataItemsCount", mvarDataItemsCount, 0 For I = 1 To mvarDataItemsCount PropBag.WriteProperty "MoreDataItem" & Trim(Str(I)), mvarMoreDataItems(I) Next I End Sub '----------------------------- MOREDATAITEMS ------------------- Private Sub Class_ReadProperties(PropBag As PropertyBag) Dim I As Long Dim Tmp As New DataItems mvarCount = PropBag.ReadProperty("Count") For I = 1 To mvarCount Set Tmp = PropBag.ReadProperty("Item" & Trim(Str(I))) Add Tmp.Index, Trim(Str(Tmp.Index)) Next I End Sub Private Sub Class_WriteProperties(PropBag As PropertyBag) Dim I As Long mvarCount = mCol.Count PropBag.WriteProperty "Count", mvarCount For I = 1 To mvarCount PropBag.WriteProperty "Item" & Trim(Str(I)), mCol.Item(I) Next I End Sub '---------------------------------- DATAITEMS ------------------------ Private Sub Class_WriteProperties(PropBag As PropertyBag) Dim I As Long mvarCount = mCol.Count PropBag.WriteProperty "Index", mvarIndex, 0 PropBag.WriteProperty "Count", mvarCount, 0 For I = 1 To mvarCount PropBag.WriteProperty "Item" & Trim(Str(I)), mCol.Item(I) Next I End Sub Private Sub Class_ReadProperties(PropBag As PropertyBag) Dim I As Long Dim C As Long Dim TmpItem As New DataItem mvarIndex = PropBag.ReadProperty("Index") mvarCount = PropBag.ReadProperty("Count") For I = 1 To mvarCount Set TmpItem = PropBag.ReadProperty("Item" & Trim(Str(I))) Add TmpItem.Value, TmpItem.DataValue, Trim(Str(I)) Next I End Sub '---------------------------------- DATA ITEM ------------------------ Private Sub Class_ReadProperties(PropBag As PropertyBag) mvarValue = PropBag.ReadProperty("Value", "") mvarDataValue = PropBag.ReadProperty("DataValue", 0) End Sub Private Sub Class_WriteProperties(PropBag As PropertyBag) Call PropBag.WriteProperty("Value", mvarValue, "") Call PropBag.WriteProperty("DataValue", mvarDataValue, 0) End Sub
|
Thu, 23 Jun 2005 03:12:51 GMT |
|
 |
D.. #2 / 21
|
 Persisting a Collection of a Collection
Without to much detail here is one solution I came up with that seems to work for what I'm doing. The project I'm currently working on has an option to generate VB Form files and it needs someway to write out many data points. Example: Points = "23,7,481,7,481,8,483,8,483,9,484,9,484,10,485,10,485,11,487,11,487,13,489,13,489,14,490,14,490,16,491,16,491,25, <zapped> At frist I was setting up Points as a Const but for some reason that escapes me now I have them as strings. At form load it splits this string into an array and then uses that array to do what needs to be done with all them numbers.. (creates an irregular shaped form) This could be something to think about for Constant Data storage within the program its self. Another option would be to set up a function/property in the Class to return each Data field.. (just kidding on this one) Just food for thought.... Quote:
>Ok here is the question: >I am creating an activex Grid control that will automatically include a >combo box in the cell with a list of items. I want to add the ability to >create lists for the combo box (per column lists for the time being) and >bind the lists to the control. >I decided to create a class (dataitem.cls) that will hold just the >"itemdata" and the "value" for each item in list. (this is the ITEM) >Then I created a collection class based on the the dataitem class >(dataitemS.cls). (This is the LIST) >Now because the grid will have multiple columns I added another collection >class based on the dataitemS class (moredataitems.cls). For each column >that will have a combo a collection is created and linked to that column. >(These are the COLUMNS) >The moredataitems collection is the only collection I had to build into the >Control. The problem is I would like to add the data items to the control >at DESIGN time. This will require some form of collection persitance, yet I >can not, for the life of me, find any instructions on how to persist arrays >or collections. I have thought about using an external file to do the >trick, but then I would have to always include that file in my source if I >wanted to transport the code to another box or I would lose the all the >items. >Does ANYONE know how to persist a collection in this manner is such a way >that you do not have to create an external file to keep track of? I would >prefer if there was a way to write the property data the same way any other >control property is stored in the form file. >Matt >Below is a sample idea I have tried but with out success (Generates run-time >error '713', class not registered, looking for object with classID: >{x-x-x-x-x} error when I attempt to re-open the form with the new grid >control) NOTE: The persistable property of each class object is set to >true, multi-use.: >'----------------------------- CONTROL ------------------------ >Private Sub UserControl_ReadProperties(PropBag As PropertyBag) > Dim I As Long > dim Tmp as object > mvarDataItemsCount = PropBag.ReadProperty("MoreDataItemsCount", 0) > For I = 1 To mvarDataItemsCount > Set Tmp = PropBag.ReadProperty("MoreDataItem" & Trim(Str(I))) > Next I >End Sub >Private Sub UserControl_WriteProperties(PropBag As PropertyBag) > Dim I As Long > mvarDataItemsCount = mvarMoreDataItems.Count > PropBag.WriteProperty "MoreDataItemsCount", mvarDataItemsCount, 0 > For I = 1 To mvarDataItemsCount > PropBag.WriteProperty "MoreDataItem" & Trim(Str(I)), >mvarMoreDataItems(I) > Next I >End Sub >'----------------------------- MOREDATAITEMS ------------------- >Private Sub Class_ReadProperties(PropBag As PropertyBag) > Dim I As Long > Dim Tmp As New DataItems > mvarCount = PropBag.ReadProperty("Count") > For I = 1 To mvarCount > Set Tmp = PropBag.ReadProperty("Item" & Trim(Str(I))) > Add Tmp.Index, Trim(Str(Tmp.Index)) > Next I >End Sub >Private Sub Class_WriteProperties(PropBag As PropertyBag) > Dim I As Long > mvarCount = mCol.Count > PropBag.WriteProperty "Count", mvarCount > For I = 1 To mvarCount > PropBag.WriteProperty "Item" & Trim(Str(I)), mCol.Item(I) > Next I >End Sub >'---------------------------------- DATAITEMS ------------------------ >Private Sub Class_WriteProperties(PropBag As PropertyBag) > Dim I As Long > mvarCount = mCol.Count > PropBag.WriteProperty "Index", mvarIndex, 0 > PropBag.WriteProperty "Count", mvarCount, 0 > For I = 1 To mvarCount > PropBag.WriteProperty "Item" & Trim(Str(I)), mCol.Item(I) > Next I >End Sub >Private Sub Class_ReadProperties(PropBag As PropertyBag) > Dim I As Long > Dim C As Long > Dim TmpItem As New DataItem > mvarIndex = PropBag.ReadProperty("Index") > mvarCount = PropBag.ReadProperty("Count") > For I = 1 To mvarCount > Set TmpItem = PropBag.ReadProperty("Item" & Trim(Str(I))) > Add TmpItem.Value, TmpItem.DataValue, Trim(Str(I)) > Next I >End Sub >'---------------------------------- DATA ITEM ------------------------ >Private Sub Class_ReadProperties(PropBag As PropertyBag) > mvarValue = PropBag.ReadProperty("Value", "") > mvarDataValue = PropBag.ReadProperty("DataValue", 0) >End Sub >Private Sub Class_WriteProperties(PropBag As PropertyBag) > Call PropBag.WriteProperty("Value", mvarValue, "") > Call PropBag.WriteProperty("DataValue", mvarDataValue, 0) >End Sub
Have a good day... Don
|
Thu, 23 Jun 2005 03:43:57 GMT |
|
 |
ME #3 / 21
|
 Persisting a Collection of a Collection
Ok, if I understand this correctly you are suggesting doing away with persisting the Collections and classes and simply persist the data via a CSV style string (i'm thinking variant actually as the 255 char limitation will make using a string difficult). Then when read an interal sub would rebuild the collection based on the string values. It could work. Though I think it is a bit "dirty". I think I will hold off a bit though just to see if there is any way to get the original idea working (as it would seem to be a bit more "clean"). Thank you for idea though. If all else fails I shall explore it. Matt
Quote: > Without to much detail here is one solution I came up with that seems to
work for what I'm doing. Quote: > The project I'm currently working on has an option to generate VB Form
files and it needs someway Quote: > to write out many data points. > Example: > Points =
"23,7,481,7,481,8,483,8,483,9,484,9,484,10,485,10,485,11,487,11,487,13,489,1 3,489,14,490,14,490,16,491,16,491,25, <zapped> Quote: > At frist I was setting up Points as a Const but for some reason that
escapes me now I have them as strings. Quote: > At form load it splits this string into an array and then uses that array
to do what needs to be done with all them numbers.. Quote: > (creates an irregular shaped form) > This could be something to think about for Constant Data storage within
the program its self. Quote: > Another option would be to set up a function/property in the Class to
return each Data field.. (just kidding on this one) Quote: > Just food for thought....
> >Ok here is the question: > >I am creating an activex Grid control that will automatically include a > >combo box in the cell with a list of items. I want to add the ability to > >create lists for the combo box (per column lists for the time being) and > >bind the lists to the control. > >I decided to create a class (dataitem.cls) that will hold just the > >"itemdata" and the "value" for each item in list. (this is the ITEM) > >Then I created a collection class based on the the dataitem class > >(dataitemS.cls). (This is the LIST) > >Now because the grid will have multiple columns I added another collection > >class based on the dataitemS class (moredataitems.cls). For each column > >that will have a combo a collection is created and linked to that column. > >(These are the COLUMNS) > >The moredataitems collection is the only collection I had to build into the > >Control. The problem is I would like to add the data items to the control > >at DESIGN time. This will require some form of collection persitance, yet I > >can not, for the life of me, find any instructions on how to persist arrays > >or collections. I have thought about using an external file to do the > >trick, but then I would have to always include that file in my source if I > >wanted to transport the code to another box or I would lose the all the > >items. > >Does ANYONE know how to persist a collection in this manner is such a way > >that you do not have to create an external file to keep track of? I would > >prefer if there was a way to write the property data the same way any other > >control property is stored in the form file. > >Matt > >Below is a sample idea I have tried but with out success (Generates run-time > >error '713', class not registered, looking for object with classID: > >{x-x-x-x-x} error when I attempt to re-open the form with the new grid > >control) NOTE: The persistable property of each class object is set to > >true, multi-use.: > >'----------------------------- CONTROL ------------------------ > >Private Sub UserControl_ReadProperties(PropBag As PropertyBag) > > Dim I As Long > > dim Tmp as object > > mvarDataItemsCount = PropBag.ReadProperty("MoreDataItemsCount", 0) > > For I = 1 To mvarDataItemsCount > > Set Tmp = PropBag.ReadProperty("MoreDataItem" & Trim(Str(I))) > > Next I > >End Sub > >Private Sub UserControl_WriteProperties(PropBag As PropertyBag) > > Dim I As Long > > mvarDataItemsCount = mvarMoreDataItems.Count > > PropBag.WriteProperty "MoreDataItemsCount", mvarDataItemsCount, 0 > > For I = 1 To mvarDataItemsCount > > PropBag.WriteProperty "MoreDataItem" & Trim(Str(I)), > >mvarMoreDataItems(I) > > Next I > >End Sub > >'----------------------------- MOREDATAITEMS ------------------- > >Private Sub Class_ReadProperties(PropBag As PropertyBag) > > Dim I As Long > > Dim Tmp As New DataItems > > mvarCount = PropBag.ReadProperty("Count") > > For I = 1 To mvarCount > > Set Tmp = PropBag.ReadProperty("Item" & Trim(Str(I))) > > Add Tmp.Index, Trim(Str(Tmp.Index)) > > Next I > >End Sub > >Private Sub Class_WriteProperties(PropBag As PropertyBag) > > Dim I As Long > > mvarCount = mCol.Count > > PropBag.WriteProperty "Count", mvarCount > > For I = 1 To mvarCount > > PropBag.WriteProperty "Item" & Trim(Str(I)), mCol.Item(I) > > Next I > >End Sub > >'---------------------------------- DATAITEMS ------------------------ > >Private Sub Class_WriteProperties(PropBag As PropertyBag) > > Dim I As Long > > mvarCount = mCol.Count > > PropBag.WriteProperty "Index", mvarIndex, 0 > > PropBag.WriteProperty "Count", mvarCount, 0 > > For I = 1 To mvarCount > > PropBag.WriteProperty "Item" & Trim(Str(I)), mCol.Item(I) > > Next I > >End Sub > >Private Sub Class_ReadProperties(PropBag As PropertyBag) > > Dim I As Long > > Dim C As Long > > Dim TmpItem As New DataItem > > mvarIndex = PropBag.ReadProperty("Index") > > mvarCount = PropBag.ReadProperty("Count") > > For I = 1 To mvarCount > > Set TmpItem = PropBag.ReadProperty("Item" & Trim(Str(I))) > > Add TmpItem.Value, TmpItem.DataValue, Trim(Str(I)) > > Next I > >End Sub > >'---------------------------------- DATA ITEM ------------------------ > >Private Sub Class_ReadProperties(PropBag As PropertyBag) > > mvarValue = PropBag.ReadProperty("Value", "") > > mvarDataValue = PropBag.ReadProperty("DataValue", 0) > >End Sub > >Private Sub Class_WriteProperties(PropBag As PropertyBag) > > Call PropBag.WriteProperty("Value", mvarValue, "") > > Call PropBag.WriteProperty("DataValue", mvarDataValue, 0) > >End Sub > Have a good day... > Don
|
Thu, 23 Jun 2005 05:33:38 GMT |
|
 |
Clothild #4 / 21
|
 Persisting a Collection of a Collection
There's no way to make the collection persist as such. The challenge is to choose a way to store the data you need to recreate the collection. A simple approach is to write constants (or whatever) into the collection class, so when you instantiate the collection it automatically populates itsself.
Quote: > Ok here is the question: > I am creating an activex Grid control that will automatically include a > combo box in the cell with a list of items. I want to add the ability to > create lists for the combo box (per column lists for the time being) and > bind the lists to the control. > I decided to create a class (dataitem.cls) that will hold just the > "itemdata" and the "value" for each item in list. (this is the ITEM) > Then I created a collection class based on the the dataitem class > (dataitemS.cls). (This is the LIST) > Now because the grid will have multiple columns I added another collection > class based on the dataitemS class (moredataitems.cls). For each column > that will have a combo a collection is created and linked to that column. > (These are the COLUMNS) > The moredataitems collection is the only collection I had to build into the > Control. The problem is I would like to add the data items to the control > at DESIGN time. This will require some form of collection persitance, yet I > can not, for the life of me, find any instructions on how to persist arrays > or collections. I have thought about using an external file to do the > trick, but then I would have to always include that file in my source if I > wanted to transport the code to another box or I would lose the all the > items. > Does ANYONE know how to persist a collection in this manner is such a way > that you do not have to create an external file to keep track of? I would > prefer if there was a way to write the property data the same way any other > control property is stored in the form file. > Matt > Below is a sample idea I have tried but with out success (Generates run-time > error '713', class not registered, looking for object with classID: > {x-x-x-x-x} error when I attempt to re-open the form with the new grid > control) NOTE: The persistable property of each class object is set to > true, multi-use.: > '----------------------------- CONTROL ------------------------ > Private Sub UserControl_ReadProperties(PropBag As PropertyBag) > Dim I As Long > dim Tmp as object > mvarDataItemsCount = PropBag.ReadProperty("MoreDataItemsCount", 0) > For I = 1 To mvarDataItemsCount > Set Tmp = PropBag.ReadProperty("MoreDataItem" & Trim(Str(I))) > Next I > End Sub > Private Sub UserControl_WriteProperties(PropBag As PropertyBag) > Dim I As Long > mvarDataItemsCount = mvarMoreDataItems.Count > PropBag.WriteProperty "MoreDataItemsCount", mvarDataItemsCount, 0 > For I = 1 To mvarDataItemsCount > PropBag.WriteProperty "MoreDataItem" & Trim(Str(I)), > mvarMoreDataItems(I) > Next I > End Sub > '----------------------------- MOREDATAITEMS ------------------- > Private Sub Class_ReadProperties(PropBag As PropertyBag) > Dim I As Long > Dim Tmp As New DataItems > mvarCount = PropBag.ReadProperty("Count") > For I = 1 To mvarCount > Set Tmp = PropBag.ReadProperty("Item" & Trim(Str(I))) > Add Tmp.Index, Trim(Str(Tmp.Index)) > Next I > End Sub > Private Sub Class_WriteProperties(PropBag As PropertyBag) > Dim I As Long > mvarCount = mCol.Count > PropBag.WriteProperty "Count", mvarCount > For I = 1 To mvarCount > PropBag.WriteProperty "Item" & Trim(Str(I)), mCol.Item(I) > Next I > End Sub > '---------------------------------- DATAITEMS ------------------------ > Private Sub Class_WriteProperties(PropBag As PropertyBag) > Dim I As Long > mvarCount = mCol.Count > PropBag.WriteProperty "Index", mvarIndex, 0 > PropBag.WriteProperty "Count", mvarCount, 0 > For I = 1 To mvarCount > PropBag.WriteProperty "Item" & Trim(Str(I)), mCol.Item(I) > Next I > End Sub > Private Sub Class_ReadProperties(PropBag As PropertyBag) > Dim I As Long > Dim C As Long > Dim TmpItem As New DataItem > mvarIndex = PropBag.ReadProperty("Index") > mvarCount = PropBag.ReadProperty("Count") > For I = 1 To mvarCount > Set TmpItem = PropBag.ReadProperty("Item" & Trim(Str(I))) > Add TmpItem.Value, TmpItem.DataValue, Trim(Str(I)) > Next I > End Sub > '---------------------------------- DATA ITEM ------------------------ > Private Sub Class_ReadProperties(PropBag As PropertyBag) > mvarValue = PropBag.ReadProperty("Value", "") > mvarDataValue = PropBag.ReadProperty("DataValue", 0) > End Sub > Private Sub Class_WriteProperties(PropBag As PropertyBag) > Call PropBag.WriteProperty("Value", mvarValue, "") > Call PropBag.WriteProperty("DataValue", mvarDataValue, 0) > End Sub
|
Thu, 23 Jun 2005 06:07:46 GMT |
|
 |
D.. #5 / 21
|
 Persisting a Collection of a Collection
What 255 character limit??? Quote:
>Ok, if I understand this correctly you are suggesting doing away with >persisting the Collections and classes and simply persist the data via a CSV >style string (i'm thinking variant actually as the 255 char limitation will >make using a string difficult). Then when read an interal sub would rebuild >the collection based on the string values. It could work. Though I think >it is a bit "dirty". I think I will hold off a bit though just to see if >there is any way to get the original idea working (as it would seem to be a >bit more "clean"). Thank you for idea though. If all else fails I shall >explore it. >Matt
>> Without to much detail here is one solution I came up with that seems to >work for what I'm doing. >> The project I'm currently working on has an option to generate VB Form >files and it needs someway >> to write out many data points. >> Example: >> Points = >"23,7,481,7,481,8,483,8,483,9,484,9,484,10,485,10,485,11,487,11,487,13,489,1 >3,489,14,490,14,490,16,491,16,491,25, <zapped> >> At frist I was setting up Points as a Const but for some reason that >escapes me now I have them as strings. >> At form load it splits this string into an array and then uses that array >to do what needs to be done with all them numbers.. >> (creates an irregular shaped form) >> This could be something to think about for Constant Data storage within >the program its self. >> Another option would be to set up a function/property in the Class to >return each Data field.. (just kidding on this one) >> Just food for thought....
>> >Ok here is the question: >> >I am creating an activex Grid control that will automatically include a >> >combo box in the cell with a list of items. I want to add the ability to >> >create lists for the combo box (per column lists for the time being) and >> >bind the lists to the control. >> >I decided to create a class (dataitem.cls) that will hold just the >> >"itemdata" and the "value" for each item in list. (this is the ITEM) >> >Then I created a collection class based on the the dataitem class >> >(dataitemS.cls). (This is the LIST) >> >Now because the grid will have multiple columns I added another >collection >> >class based on the dataitemS class (moredataitems.cls). For each column >> >that will have a combo a collection is created and linked to that column. >> >(These are the COLUMNS) >> >The moredataitems collection is the only collection I had to build into >the >> >Control. The problem is I would like to add the data items to the >control >> >at DESIGN time. This will require some form of collection persitance, >yet I >> >can not, for the life of me, find any instructions on how to persist >arrays >> >or collections. I have thought about using an external file to do the >> >trick, but then I would have to always include that file in my source if >I >> >wanted to transport the code to another box or I would lose the all the >> >items. >> >Does ANYONE know how to persist a collection in this manner is such a way >> >that you do not have to create an external file to keep track of? I >would >> >prefer if there was a way to write the property data the same way any >other >> >control property is stored in the form file. >> >Matt >> >Below is a sample idea I have tried but with out success (Generates >run-time >> >error '713', class not registered, looking for object with classID: >> >{x-x-x-x-x} error when I attempt to re-open the form with the new grid >> >control) NOTE: The persistable property of each class object is set to >> >true, multi-use.: >> >'----------------------------- CONTROL ------------------------ >> >Private Sub UserControl_ReadProperties(PropBag As PropertyBag) >> > Dim I As Long >> > dim Tmp as object >> > mvarDataItemsCount = PropBag.ReadProperty("MoreDataItemsCount", 0) >> > For I = 1 To mvarDataItemsCount >> > Set Tmp = PropBag.ReadProperty("MoreDataItem" & Trim(Str(I))) >> > Next I >> >End Sub >> >Private Sub UserControl_WriteProperties(PropBag As PropertyBag) >> > Dim I As Long >> > mvarDataItemsCount = mvarMoreDataItems.Count >> > PropBag.WriteProperty "MoreDataItemsCount", mvarDataItemsCount, 0 >> > For I = 1 To mvarDataItemsCount >> > PropBag.WriteProperty "MoreDataItem" & Trim(Str(I)), >> >mvarMoreDataItems(I) >> > Next I >> >End Sub >> >'----------------------------- MOREDATAITEMS ------------------- >> >Private Sub Class_ReadProperties(PropBag As PropertyBag) >> > Dim I As Long >> > Dim Tmp As New DataItems >> > mvarCount = PropBag.ReadProperty("Count") >> > For I = 1 To mvarCount >> > Set Tmp = PropBag.ReadProperty("Item" & Trim(Str(I))) >> > Add Tmp.Index, Trim(Str(Tmp.Index)) >> > Next I >> >End Sub >> >Private Sub Class_WriteProperties(PropBag As PropertyBag) >> > Dim I As Long >> > mvarCount = mCol.Count >> > PropBag.WriteProperty "Count", mvarCount >> > For I = 1 To mvarCount >> > PropBag.WriteProperty "Item" & Trim(Str(I)), mCol.Item(I) >> > Next I >> >End Sub >> >'---------------------------------- DATAITEMS ------------------------ >> >Private Sub Class_WriteProperties(PropBag As PropertyBag) >> > Dim I As Long >> > mvarCount = mCol.Count >> > PropBag.WriteProperty "Index", mvarIndex, 0 >> > PropBag.WriteProperty "Count", mvarCount, 0 >> > For I = 1 To mvarCount >> > PropBag.WriteProperty "Item" & Trim(Str(I)), mCol.Item(I) >> > Next I >> >End Sub >> >Private Sub Class_ReadProperties(PropBag As PropertyBag) >> > Dim I As Long >> > Dim C As Long >> > Dim TmpItem As New DataItem >> > mvarIndex = PropBag.ReadProperty("Index") >> > mvarCount = PropBag.ReadProperty("Count") >> > For I = 1 To mvarCount >> > Set TmpItem = PropBag.ReadProperty("Item" & Trim(Str(I))) >> > Add TmpItem.Value, TmpItem.DataValue, Trim(Str(I)) >> > Next I >> >End Sub >> >'---------------------------------- DATA ITEM ------------------------ >> >Private Sub Class_ReadProperties(PropBag As PropertyBag) >> > mvarValue = PropBag.ReadProperty("Value", "") >> > mvarDataValue = PropBag.ReadProperty("DataValue", 0) >> >End Sub >> >Private Sub Class_WriteProperties(PropBag As PropertyBag) >> > Call PropBag.WriteProperty("Value", mvarValue, "") >> > Call PropBag.WriteProperty("DataValue", mvarDataValue, 0) >> >End Sub >> Have a good day... >> Don
Have a good day... Don
|
Thu, 23 Jun 2005 06:18:18 GMT |
|
 |
ME #6 / 21
|
 Persisting a Collection of a Collection
Forgive me. I have learned VB on my own. I come from the old days where strings could not be filled with more than 255 chars. Is this different in VB or am I just a moron who doesn't get it? Please feel free to correct me. I love being corrected. Matt
Quote: > What 255 character limit???
> >Ok, if I understand this correctly you are suggesting doing away with > >persisting the Collections and classes and simply persist the data via a CSV > >style string (i'm thinking variant actually as the 255 char limitation will > >make using a string difficult). Then when read an interal sub would rebuild > >the collection based on the string values. It could work. Though I think > >it is a bit "dirty". I think I will hold off a bit though just to see if > >there is any way to get the original idea working (as it would seem to be a > >bit more "clean"). Thank you for idea though. If all else fails I shall > >explore it. > >Matt
> >> Without to much detail here is one solution I came up with that seems to > >work for what I'm doing. > >> The project I'm currently working on has an option to generate VB Form > >files and it needs someway > >> to write out many data points. > >> Example: > >> Points = >"23,7,481,7,481,8,483,8,483,9,484,9,484,10,485,10,485,11,487,11,487,13,489, 1 > >3,489,14,490,14,490,16,491,16,491,25, <zapped> > >> At frist I was setting up Points as a Const but for some reason that > >escapes me now I have them as strings. > >> At form load it splits this string into an array and then uses that array > >to do what needs to be done with all them numbers.. > >> (creates an irregular shaped form) > >> This could be something to think about for Constant Data storage within > >the program its self. > >> Another option would be to set up a function/property in the Class to > >return each Data field.. (just kidding on this one) > >> Just food for thought....
> >> >Ok here is the question: > >> >I am creating an activex Grid control that will automatically include a > >> >combo box in the cell with a list of items. I want to add the ability to > >> >create lists for the combo box (per column lists for the time being) and > >> >bind the lists to the control. > >> >I decided to create a class (dataitem.cls) that will hold just the > >> >"itemdata" and the "value" for each item in list. (this is the ITEM) > >> >Then I created a collection class based on the the dataitem class > >> >(dataitemS.cls). (This is the LIST) > >> >Now because the grid will have multiple columns I added another > >collection > >> >class based on the dataitemS class (moredataitems.cls). For each column > >> >that will have a combo a collection is created and linked to that column. > >> >(These are the COLUMNS) > >> >The moredataitems collection is the only collection I had to build into > >the > >> >Control. The problem is I would like to add the data items to the > >control > >> >at DESIGN time. This will require some form of collection persitance, > >yet I > >> >can not, for the life of me, find any instructions on how to persist > >arrays > >> >or collections. I have thought about using an external file to do the > >> >trick, but then I would have to always include that file in my source if > >I > >> >wanted to transport the code to another box or I would lose the all the > >> >items. > >> >Does ANYONE know how to persist a collection in this manner is such a way > >> >that you do not have to create an external file to keep track of? I > >would > >> >prefer if there was a way to write the property data the same way any > >other > >> >control property is stored in the form file. > >> >Matt > >> >Below is a sample idea I have tried but with out success (Generates > >run-time > >> >error '713', class not registered, looking for object with classID: > >> >{x-x-x-x-x} error when I attempt to re-open the form with the new grid > >> >control) NOTE: The persistable property of each class object is set to > >> >true, multi-use.: > >> >'----------------------------- CONTROL ------------------------ > >> >Private Sub UserControl_ReadProperties(PropBag As PropertyBag) > >> > Dim I As Long > >> > dim Tmp as object > >> > mvarDataItemsCount = PropBag.ReadProperty("MoreDataItemsCount", 0) > >> > For I = 1 To mvarDataItemsCount > >> > Set Tmp = PropBag.ReadProperty("MoreDataItem" & Trim(Str(I))) > >> > Next I > >> >End Sub > >> >Private Sub UserControl_WriteProperties(PropBag As PropertyBag) > >> > Dim I As Long > >> > mvarDataItemsCount = mvarMoreDataItems.Count > >> > PropBag.WriteProperty "MoreDataItemsCount", mvarDataItemsCount, 0 > >> > For I = 1 To mvarDataItemsCount > >> > PropBag.WriteProperty "MoreDataItem" & Trim(Str(I)), > >> >mvarMoreDataItems(I) > >> > Next I > >> >End Sub > >> >'----------------------------- MOREDATAITEMS ------------------- > >> >Private Sub Class_ReadProperties(PropBag As PropertyBag) > >> > Dim I As Long > >> > Dim Tmp As New DataItems > >> > mvarCount = PropBag.ReadProperty("Count") > >> > For I = 1 To mvarCount > >> > Set Tmp = PropBag.ReadProperty("Item" & Trim(Str(I))) > >> > Add Tmp.Index, Trim(Str(Tmp.Index)) > >> > Next I > >> >End Sub > >> >Private Sub Class_WriteProperties(PropBag As PropertyBag) > >> > Dim I As Long > >> > mvarCount = mCol.Count > >> > PropBag.WriteProperty "Count", mvarCount > >> > For I = 1 To mvarCount > >> > PropBag.WriteProperty "Item" & Trim(Str(I)), mCol.Item(I) > >> > Next I > >> >End Sub > >> >'---------------------------------- DATAITEMS ------------------------ > >> >Private Sub Class_WriteProperties(PropBag As PropertyBag) > >> > Dim I As Long > >> > mvarCount = mCol.Count > >> > PropBag.WriteProperty "Index", mvarIndex, 0 > >> > PropBag.WriteProperty "Count", mvarCount, 0 > >> > For I = 1 To mvarCount > >> > PropBag.WriteProperty "Item" & Trim(Str(I)), mCol.Item(I) > >> > Next I > >> >End Sub > >> >Private Sub Class_ReadProperties(PropBag As PropertyBag) > >> > Dim I As Long > >> > Dim C As Long > >> > Dim TmpItem As New DataItem > >> > mvarIndex = PropBag.ReadProperty("Index") > >> > mvarCount = PropBag.ReadProperty("Count") > >> > For I = 1 To mvarCount > >> > Set TmpItem = PropBag.ReadProperty("Item" & Trim(Str(I))) > >> > Add TmpItem.Value, TmpItem.DataValue, Trim(Str(I)) > >> > Next I > >> >End Sub > >> >'---------------------------------- DATA ITEM ------------------------ > >> >Private Sub Class_ReadProperties(PropBag As PropertyBag) > >> > mvarValue = PropBag.ReadProperty("Value", "") > >> > mvarDataValue = PropBag.ReadProperty("DataValue", 0) > >> >End Sub > >> >Private Sub Class_WriteProperties(PropBag As PropertyBag) > >> > Call PropBag.WriteProperty("Value", mvarValue, "") > >> > Call PropBag.WriteProperty("DataValue", mvarDataValue, 0) > >> >End Sub > >> Have a good day... > >> Don > Have a good day... > Don
|
Thu, 23 Jun 2005 06:22:39 GMT |
|
 |
ME #7 / 21
|
 Persisting a Collection of a Collection
Just one more question. I know there is a way to persist an array of data. What is the eaisest way to persist an array? Would one do this: dim ItemCount as long dim I as long dim v() as string redim v(10) itemcount=10 propbag.writeproperty "ItemCount", Itemcount for i=1 to 10 PropBag.WriteProperty "Item" & Trim(Str(I)), V(I) next i --------- and the read dim ItemCount as long dim I as long dim V() as string ItemCount=PropBag.ReadProperty("ItemCount") redm V(ItemCount) for i =1 to itemcount v(i)=PropBag.ReadProperty("Item" & Trim(Str(I))) next i Is this correct? Matt
Quote: > There's no way to make the collection persist as such. The challenge is to > choose a way to store the data you need to recreate the collection. A simple > approach is to write constants (or whatever) into the collection class, so > when you instantiate the collection it automatically populates itsself.
> > Ok here is the question: > > I am creating an activex Grid control that will automatically include a > > combo box in the cell with a list of items. I want to add the ability to > > create lists for the combo box (per column lists for the time being) and > > bind the lists to the control. > > I decided to create a class (dataitem.cls) that will hold just the > > "itemdata" and the "value" for each item in list. (this is the ITEM) > > Then I created a collection class based on the the dataitem class > > (dataitemS.cls). (This is the LIST) > > Now because the grid will have multiple columns I added another collection > > class based on the dataitemS class (moredataitems.cls). For each column > > that will have a combo a collection is created and linked to that column. > > (These are the COLUMNS) > > The moredataitems collection is the only collection I had to build into > the > > Control. The problem is I would like to add the data items to the control > > at DESIGN time. This will require some form of collection persitance, yet > I > > can not, for the life of me, find any instructions on how to persist > arrays > > or collections. I have thought about using an external file to do the > > trick, but then I would have to always include that file in my source if I > > wanted to transport the code to another box or I would lose the all the > > items. > > Does ANYONE know how to persist a collection in this manner is such a way > > that you do not have to create an external file to keep track of? I would > > prefer if there was a way to write the property data the same way any > other > > control property is stored in the form file. > > Matt > > Below is a sample idea I have tried but with out success (Generates > run-time > > error '713', class not registered, looking for object with classID: > > {x-x-x-x-x} error when I attempt to re-open the form with the new grid > > control) NOTE: The persistable property of each class object is set to > > true, multi-use.: > > '----------------------------- CONTROL ------------------------ > > Private Sub UserControl_ReadProperties(PropBag As PropertyBag) > > Dim I As Long > > dim Tmp as object > > mvarDataItemsCount = PropBag.ReadProperty("MoreDataItemsCount", 0) > > For I = 1 To mvarDataItemsCount > > Set Tmp = PropBag.ReadProperty("MoreDataItem" & Trim(Str(I))) > > Next I > > End Sub > > Private Sub UserControl_WriteProperties(PropBag As PropertyBag) > > Dim I As Long > > mvarDataItemsCount = mvarMoreDataItems.Count > > PropBag.WriteProperty "MoreDataItemsCount", mvarDataItemsCount, 0 > > For I = 1 To mvarDataItemsCount > > PropBag.WriteProperty "MoreDataItem" & Trim(Str(I)), > > mvarMoreDataItems(I) > > Next I > > End Sub > > '----------------------------- MOREDATAITEMS ------------------- > > Private Sub Class_ReadProperties(PropBag As PropertyBag) > > Dim I As Long > > Dim Tmp As New DataItems > > mvarCount = PropBag.ReadProperty("Count") > > For I = 1 To mvarCount > > Set Tmp = PropBag.ReadProperty("Item" & Trim(Str(I))) > > Add Tmp.Index, Trim(Str(Tmp.Index)) > > Next I > > End Sub > > Private Sub Class_WriteProperties(PropBag As PropertyBag) > > Dim I As Long > > mvarCount = mCol.Count > > PropBag.WriteProperty "Count", mvarCount > > For I = 1 To mvarCount > > PropBag.WriteProperty "Item" & Trim(Str(I)), mCol.Item(I) > > Next I > > End Sub > > '---------------------------------- DATAITEMS ------------------------ > > Private Sub Class_WriteProperties(PropBag As PropertyBag) > > Dim I As Long > > mvarCount = mCol.Count > > PropBag.WriteProperty "Index", mvarIndex, 0 > > PropBag.WriteProperty "Count", mvarCount, 0 > > For I = 1 To mvarCount > > PropBag.WriteProperty "Item" & Trim(Str(I)), mCol.Item(I) > > Next I > > End Sub > > Private Sub Class_ReadProperties(PropBag As PropertyBag) > > Dim I As Long > > Dim C As Long > > Dim TmpItem As New DataItem > > mvarIndex = PropBag.ReadProperty("Index") > > mvarCount = PropBag.ReadProperty("Count") > > For I = 1 To mvarCount > > Set TmpItem = PropBag.ReadProperty("Item" & Trim(Str(I))) > > Add TmpItem.Value, TmpItem.DataValue, Trim(Str(I)) > > Next I > > End Sub > > '---------------------------------- DATA ITEM ------------------------ > > Private Sub Class_ReadProperties(PropBag As PropertyBag) > > mvarValue = PropBag.ReadProperty("Value", "") > > mvarDataValue = PropBag.ReadProperty("DataValue", 0) > > End Sub > > Private Sub Class_WriteProperties(PropBag As PropertyBag) > > Call PropBag.WriteProperty("Value", mvarValue, "") > > Call PropBag.WriteProperty("DataValue", mvarDataValue, 0) > > End Sub
|
Thu, 23 Jun 2005 06:26:31 GMT |
|
 |
douglas savitsk #8 / 21
|
 Persisting a Collection of a Collection
Quote:
> Forgive me. I have learned VB on my own. I come from the old days where > strings could not be filled with more than 255 chars.
Those are very old days indeed. IIRC, in VB6, fixed length strings can be up to about 65,000 characters, and variable length strings can be about 2,000,000,000. -d
|
Thu, 23 Jun 2005 07:36:18 GMT |
|
 |
D.. #9 / 21
|
 Persisting a Collection of a Collection
There are limits, as always, on the size of things in VB. But Strings is a vary large number.. Something like 2 gigabytes or someother limiting factor I don't recall right off... Fix'd length strings, ie: Dim sMyString as String * 2,000, has a max length of an Integer, 32k... Maxium line length in the IDE is 1024 bytes which could cause you a problem with a lot of data but that can be worked around also by closing the string at around 1000 bytes the add the & and continuatuation character, upto 12 lines, example: "this, is, at, the, 1000, character, limit," & _ "and, this, will, continue, the, same, string, up, to, 12, Line, Continuations" I used comma's here to make it look like data words that will be split... You mentioned Dirty.. Nothing new here.. VB has needed a bath in many years and since they couldn't clean it up the went to .NET hahahahaha HTH Quote:
>Forgive me. I have learned VB on my own. I come from the old days where >strings could not be filled with more than 255 chars. Is this different in >VB or am I just a moron who doesn't get it? Please feel free to correct me. >I love being corrected. >Matt
>> What 255 character limit???
>> >Ok, if I understand this correctly you are suggesting doing away with >> >persisting the Collections and classes and simply persist the data via a >CSV >> >style string (i'm thinking variant actually as the 255 char limitation >will >> >make using a string difficult). Then when read an interal sub would >rebuild >> >the collection based on the string values. It could work. Though I >think >> >it is a bit "dirty". I think I will hold off a bit though just to see if >> >there is any way to get the original idea working (as it would seem to be >a >> >bit more "clean"). Thank you for idea though. If all else fails I shall >> >explore it. >> >Matt
>> >> Without to much detail here is one solution I came up with that seems >to >> >work for what I'm doing. >> >> The project I'm currently working on has an option to generate VB Form >> >files and it needs someway >> >> to write out many data points. >> >> Example: >> >> Points = >>"23,7,481,7,481,8,483,8,483,9,484,9,484,10,485,10,485,11,487,11,487,13,489, >1 >> >3,489,14,490,14,490,16,491,16,491,25, <zapped> >> >> At frist I was setting up Points as a Const but for some reason that >> >escapes me now I have them as strings. >> >> At form load it splits this string into an array and then uses that >array >> >to do what needs to be done with all them numbers.. >> >> (creates an irregular shaped form) >> >> This could be something to think about for Constant Data storage within >> >the program its self. >> >> Another option would be to set up a function/property in the Class to >> >return each Data field.. (just kidding on this one) >> >> Just food for thought....
>> >> >Ok here is the question: >> >> >I am creating an activex Grid control that will automatically include >a >> >> >combo box in the cell with a list of items. I want to add the ability >to >> >> >create lists for the combo box (per column lists for the time being) >and >> >> >bind the lists to the control. >> >> >I decided to create a class (dataitem.cls) that will hold just the >> >> >"itemdata" and the "value" for each item in list. (this is the ITEM) >> >> >Then I created a collection class based on the the dataitem class >> >> >(dataitemS.cls). (This is the LIST) >> >> >Now because the grid will have multiple columns I added another >> >collection >> >> >class based on the dataitemS class (moredataitems.cls). For each >column >> >> >that will have a combo a collection is created and linked to that >column. >> >> >(These are the COLUMNS) >> >> >The moredataitems collection is the only collection I had to build >into >> >the >> >> >Control. The problem is I would like to add the data items to the >> >control >> >> >at DESIGN time. This will require some form of collection persitance, >> >yet I >> >> >can not, for the life of me, find any instructions on how to persist >> >arrays >> >> >or collections. I have thought about using an external file to do the >> >> >trick, but then I would have to always include that file in my source >if >> >I >> >> >wanted to transport the code to another box or I would lose the all >the >> >> >items. >> >> >Does ANYONE know how to persist a collection in this manner is such a >way >> >> >that you do not have to create an external file to keep track of? I >> >would >> >> >prefer if there was a way to write the property data the same way any >> >other >> >> >control property is stored in the form file. >> >> >Matt >> >> >Below is a sample idea I have tried but with out success (Generates >> >run-time >> >> >error '713', class not registered, looking for object with classID: >> >> >{x-x-x-x-x} error when I attempt to re-open the form with the new grid >> >> >control) NOTE: The persistable property of each class object is set >to >> >> >true, multi-use.: >> >> >'----------------------------- CONTROL ------------------------ >> >> >Private Sub UserControl_ReadProperties(PropBag As PropertyBag) >> >> > Dim I As Long >> >> > dim Tmp as object >> >> > mvarDataItemsCount = PropBag.ReadProperty("MoreDataItemsCount", 0) >> >> > For I = 1 To mvarDataItemsCount >> >> > Set Tmp = PropBag.ReadProperty("MoreDataItem" & Trim(Str(I))) >> >> > Next I >> >> >End Sub >> >> >Private Sub UserControl_WriteProperties(PropBag As PropertyBag) >> >> > Dim I As Long >> >> > mvarDataItemsCount = mvarMoreDataItems.Count >> >> > PropBag.WriteProperty "MoreDataItemsCount", mvarDataItemsCount, 0 >> >> > For I = 1 To mvarDataItemsCount >> >> > PropBag.WriteProperty "MoreDataItem" & Trim(Str(I)), >> >> >mvarMoreDataItems(I) >> >> > Next I >> >> >End Sub >> >> >'----------------------------- MOREDATAITEMS ------------------- >> >> >Private Sub Class_ReadProperties(PropBag As PropertyBag) >> >> > Dim I As Long >> >> > Dim Tmp As New DataItems >> >> > mvarCount = PropBag.ReadProperty("Count") >> >> > For I = 1 To mvarCount >> >> > Set Tmp = PropBag.ReadProperty("Item" & Trim(Str(I))) >> >> > Add Tmp.Index, Trim(Str(Tmp.Index)) >> >> > Next I >> >> >End Sub >> >> >Private Sub Class_WriteProperties(PropBag As PropertyBag) >> >> > Dim I As Long >> >> > mvarCount = mCol.Count >> >> > PropBag.WriteProperty "Count", mvarCount >> >> > For I = 1 To mvarCount >> >> > PropBag.WriteProperty "Item" & Trim(Str(I)), mCol.Item(I) >> >> > Next I >> >> >End Sub >> >> >'---------------------------------- DATAITEMS ------------------------ >> >> >Private Sub Class_WriteProperties(PropBag As PropertyBag) >> >> > Dim I As Long >> >> > mvarCount = mCol.Count >> >> > PropBag.WriteProperty "Index", mvarIndex, 0 >> >> > PropBag.WriteProperty "Count", mvarCount, 0 >> >> > For I = 1 To mvarCount >> >> > PropBag.WriteProperty "Item" & Trim(Str(I)), mCol.Item(I) >> >> > Next I >> >> >End Sub >> >> >Private Sub Class_ReadProperties(PropBag As PropertyBag) >> >> > Dim I As Long >> >> > Dim C As Long >> >> > Dim TmpItem As New DataItem >> >> > mvarIndex = PropBag.ReadProperty("Index") >> >> > mvarCount = PropBag.ReadProperty("Count") >> >> > For I = 1 To mvarCount >> >> > Set TmpItem = PropBag.ReadProperty("Item" & Trim(Str(I))) >> >> > Add TmpItem.Value, TmpItem.DataValue, Trim(Str(I)) >> >> > Next I >> >> >End Sub >> >> >'---------------------------------- DATA ITEM ------------------------ >> >> >Private Sub Class_ReadProperties(PropBag As PropertyBag) >> >> > mvarValue = PropBag.ReadProperty("Value", "") >> >> > mvarDataValue = PropBag.ReadProperty("DataValue", 0) >> >> >End Sub >> >> >Private Sub Class_WriteProperties(PropBag As PropertyBag) >> >> > Call PropBag.WriteProperty("Value", mvarValue, "") >> >> > Call PropBag.WriteProperty("DataValue", mvarDataValue, 0) >> >> >End Sub >> >> Have a good day... >> >> Don >> Have a good day... >> Don
Have a good day... Don
|
Thu, 23 Jun 2005 06:54:28 GMT |
|
 |
D.. #10 / 21
|
 Persisting a Collection of a Collection
Yep.. I was off again in my other post.. I said Integer, 32k.. and that should have been Long, 65k... It's hell getting old and forgetful... hahahhaa Quote:
>> Forgive me. I have learned VB on my own. I come from the old days where >> strings could not be filled with more than 255 chars. >Those are very old days indeed. IIRC, in VB6, fixed length strings can >be up to about 65,000 characters, and variable length strings can be >about 2,000,000,000. >-d
Have a good day... Don
|
Thu, 23 Jun 2005 07:01:44 GMT |
|
 |
D.. #11 / 21
|
 Persisting a Collection of a Collection
Oh well,,, I'll get it straight one of these days... but then again maybe not... LOL Integer, 65k... eeeeeesssshh... I give up... Quote:
>Yep.. I was off again in my other post.. >I said Integer, 32k.. and that should have been Long, 65k... >It's hell getting old and forgetful... hahahhaa
>>> Forgive me. I have learned VB on my own. I come from the old days where >>> strings could not be filled with more than 255 chars. >>Those are very old days indeed. IIRC, in VB6, fixed length strings can >>be up to about 65,000 characters, and variable length strings can be >>about 2,000,000,000. >>-d >Have a good day... >Don
Have a good day... Don
|
Thu, 23 Jun 2005 07:08:16 GMT |
|
 |
ME #12 / 21
|
 Persisting a Collection of a Collection
Well. Things HAVE come along way since the days of GW-BASIC. Looking back, boy, I guess its habit mostly that I avoid using strings to store stuff. I guess I shall have to change my thinking a little. Matt
Quote: > Oh well,,, I'll get it straight one of these days... but then again maybe not... LOL > Integer, 65k... eeeeeesssshh... I give up...
> >Yep.. I was off again in my other post.. > >I said Integer, 32k.. and that should have been Long, 65k... > >It's hell getting old and forgetful... hahahhaa > >On Sat, 04 Jan 2003 23:36:18 GMT, douglas savitsky
> >>> Forgive me. I have learned VB on my own. I come from the old days where > >>> strings could not be filled with more than 255 chars. > >>Those are very old days indeed. IIRC, in VB6, fixed length strings can > >>be up to about 65,000 characters, and variable length strings can be > >>about 2,000,000,000. > >>-d > >Have a good day... > >Don > Have a good day... > Don
|
Thu, 23 Jun 2005 07:15:16 GMT |
|
 |
D.. #13 / 21
|
 Persisting a Collection of a Collection
This is only an Idea to think about.. It might not be so good for what you are doing because if you want to add/update any of the data fields then you have to modify the Source Code and Recompile and the go through all the problems of redistribution... This is a problem of having Static Data in the EXE in any form... Even though it means distributing another file it might be better to use an external file.... But then again if it means that the new data meets a different cryteria then it is back to the source code anyways... (pitfall) It goes on from here with a lot of etc... 's... Quote:
>Well. Things HAVE come along way since the days of GW-BASIC. Looking back, >boy, I guess its habit mostly that I avoid using strings to store stuff. I >guess I shall have to change my thinking a little. >Matt
Have a good day... Don
|
Thu, 23 Jun 2005 07:28:44 GMT |
|
 |
D.. #14 / 21
|
 Persisting a Collection of a Collection
Quote:
>Without to much detail here is one solution I came up with that seems to work for what I'm doing. >The project I'm currently working on has an option to generate VB Form files and it needs someway >to write out many data points. >Example: >Points = "23,7,481,7,481,8,483,8,483,9,484,9,484,10,485,10,485,11,487,11,487,13,489, 13,489,14,490,14,490,16,491,16,491,25, <zapped> >At frist I was setting up Points as a Const but for some reason that escapes me now I have them as strings.
I was sitting here thinking why I had gotten away from using Const and going to Strings instead.. The reason was I hit the 12 Line Continuation Character maxium a couple of times so I went to strings in the following format: Points = "23,7,481,7,481,8,483,8,483,9,484,9,484,10,485,10,485,11,487,11,487,13,489,13,489,14,490,14,490,16,491,16,491,25, <zapped> Points = Points & "............ more data points here ........................." Hopefully I'll never hit that maxium... ;) Have a good day... Don
|
Thu, 23 Jun 2005 07:47:10 GMT |
|
 |
ME #15 / 21
|
 Persisting a Collection of a Collection
I have thought about it, hard. Really the only reason I want to add the data at design time is for the static fields, ie (true/false, yes/no, and program specific stuff like selectable options that sort of thing.) The plan is that if it is not static I can also add the items at run time as well. See, if you can add them at design time then everythings covered. Call me lazy perhaps but then I have always considered myself a person who work hard to be lazy :) Of course that would mean I'd have to be... a programmer maybe? Anyway, I have been thinking about your suggestion since I read it and I think it has some pretty good merit to it. All I need to do now is figure out the details of how to persist an ARRAY of data. This I am pretty sure can be done, just don't know how. Learn something new everyday! Matt
Quote: > This is only an Idea to think about.. > It might not be so good for what you are doing because if you want to
add/update any of the data fields then you have to modify the Source Code and Quote: > Recompile and the go through all the problems of redistribution... > This is a problem of having Static Data in the EXE in any form... > Even though it means distributing another file it might be better to use
an external file.... Quote: > But then again if it means that the new data meets a different cryteria
then it is back to the source code anyways... (pitfall) Quote: > It goes on from here with a lot of etc... 's...
> >Well. Things HAVE come along way since the days of GW-BASIC. Looking back, > >boy, I guess its habit mostly that I avoid using strings to store stuff. I > >guess I shall have to change my thinking a little. > >Matt > Have a good day... > Don
|
Thu, 23 Jun 2005 07:51:26 GMT |
|
|
Page 1 of 2
|
[ 21 post ] |
|
Go to page:
[1]
[2] |
|