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...

Recommended Answers

All 5 Replies

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.

how do i save value into it?

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...??

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.

You could try putting the default value into a constant.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.