I am using the built-in My.Settings functionality in VB.NET to save application settings.
This is very convenient but I notice that each time I release a new version, the settings are lost.
Why and how can I prevent it?
I am using the built-in My.Settings functionality in VB.NET to save application settings.
This is very convenient but I notice that each time I release a new version, the settings are lost.
Why and how can I prevent it?
You need to manually update your application settings, I use this easy method:
Then write a method to check if My.Settings requires updating, and call it's Update() method if so. Flag your settings as updated, and save. Call this somewhere in your app load. The Upgrade() method will update your Settings to the new format, and migrate your existing values over.
Sub UpgradeMySetings()
If My.Settings.MustUpgrade Then
My.Settings.Upgrade()
My.Settings.MustUpgrade = False
My.Settings.Save()
End If
End Sub