1

I have a project i am working on that has something similar to a bookmark system and the entries are being saved in a Specialized.StringCollection in My.Settings.

Private Sub MainFormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
    My.Settings.comboitems.Clear()
    For Each comboItem As Object In Me.ComboBox2.Items
       My.Settings.ComboItems.Add(comboItem)
    Next
    My.Settings.Save() 
End Sub 

I can then reload the application later and it saves anything that i have put in that collection but if I am on another computer or overwrite the executable with an updated version, its all gone and I have to rebuild those collections from scratch.

Is there a way to export and import this string data so when new versions are ready for testing I can just import the data again without having to rebuild the list from scratch?

I hate having to bug but I have been googling and searching here for days to no avail.

preciousbetine
  • 2,959
  • 3
  • 13
  • 29
  • 1
    The Application.Settings should only be used to maintain the _state_ of an application. Things like: the last size and location of a Form, the last selected Font of a control, the last selected Color....etc. AND nothing else. For the _Data_ you should use a _Database_, or _Serialization_ for simple applications. See [this](https://stackoverflow.com/a/59097544/10216583) post which covers the idea in more details. –  Feb 28 '20 at 23:24
  • Also [this](https://stackoverflow.com/questions/16352879/write-list-of-objects-to-a-file) post covers more... –  Feb 28 '20 at 23:28
  • [ApplicationSettingsBase.Upgrade](https://learn.microsoft.com/en-us/dotnet/api/system.configuration.applicationsettingsbase.upgrade) – Jimi Feb 29 '20 at 04:42
  • I appreciate it. I am not exactly new to coding but this is the first time I have tried to do more than simple projects, so I a not totally familiar with databases and the like. looks like I have some learnin to do. :) Thanks for the insight. I will let you know how it goes. – Nicholas Tiberius Ross Mar 01 '20 at 21:47
  • I actually did find the user.config file in my Appdata folder with all of the content saved in it so I have figured it out but I will still take a look into database access for the sake of doing things the right way. thank you so much for your help. – Nicholas Tiberius Ross Mar 01 '20 at 21:58
  • Most welcome Mr. Nicholas. Good luck. –  Mar 01 '20 at 22:12

0 Answers0