Reputation: 191
Is there any way I can save changes made by a user , so that at the next run they would still be there? I have seen something about My.Settings , is that how it is done?
Upvotes: 7
Views: 16245
Reputation: 54532
Yes you have multiple options, you can create a file and load it on startup, or you can use the built in settings object. Just go to your Project Property's
--> settings
set your variable there, the you can access it through My.Settings
Then load it like this:
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim greeting As String = My.Settings.mySetting
End Sub
you would change the value and save it like this
My.Settings.mySetting = "GoodBye"
My.Settings.Save()
Upvotes: 10