Hey guys i need some help on how to save Values in My.Settings

Two texboxes to save two different values and be albe to read those values or laod them when the program is oppned again...and also to be able to be replaced those values...

5 Years
Discussion Span
Last Post by tinstaafl

It may be slightly different depending on which version of Visual Studio you are running, but in 2010, you open the project properties and click on "Settings" about halfway down the left panel. Enter a variable name, type and scope then enter an initial value. To load the value into an app variable you can do (let's assume a string setting named LastFile)

Dim lastfile As String = My.Settings.LastFile

To save that value back (to preserve the value between successive runs) just reverse the assignment.


i got it working on saving....but what about if i wanted to make the values default..like the ones that ive sett on the main project settings...??

Edited by kenomote: typo


I don't follow. The value that you enter (if any) when you create the Settings variable is the default. A default is, by definition, the value that is used if no other value is entered.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.