Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save settings made in VB?

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?

like image 500
Dani Mateo Avatar asked Jun 27 '13 19:06

Dani Mateo


1 Answers

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

enter image description here

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()
like image 154
Mark Hall Avatar answered Sep 28 '22 10:09

Mark Hall