Tutorials Navigation

Tutorials :: New :: Popular :: Top Rated

Tutorials: 18,326 Categories: 12

Total Tutorial Views: 41,398,479

[VB.NET] How to make and save settings

Tutorial Name: [VB.NET] How to make and save settings  

Category: PC Tutorials

Submitted By: Maj

Date Added:

Comments: 2

Views: 4,100

Related Forum: PC Building Forum

Share:

Ever wanted to be able to save certain elements of you're application? Let's say you wanted to save what that textbox said last, well here's how it's done:




Step 1.) Create you're application as you normally would, for me it's very simple with 1 textbox and 1 label

[ Register or Signin to view external links. ]

Step 2.) Now on the right toolbar right click your project name and select "Properties"

[ Register or Signin to view external links. ]

Step 3.) Now Select "Settings"

[ Register or Signin to view external links. ]

Step 4.) Now in the left hand column give your setting a name. The right hand side is the default value, leave this blank as it's needed for our use.

[ Register or Signin to view external links. ]

Step 5.) Go back & add this into your app. For me I want it to save the label text.

Step 6.) Add a timer with an interval of 1000. Add the following code to the timer:

My.Settings.Example1 = Label1.Text
        My.Settings.Save()


[ Register or Signin to view external links. ]

Step 7.) Add the following code to the Form1_Load event:

[ Register or Signin to view external links. ]

Timer1.Start


Now I have a form that will automatically save the label text every second. However, for the text that has been saved to be displayed we need to make a new button and add the following code:

[ Register or Signin to view external links. ]

Label1.Text = My.Settings.Example1


All done! Just like that we've made a setting which automatically saves! Amazing right?

Ratings

Current rating: 4.67 by 3 users
Please take one second and rate this tutorial...

Not a Chance
1
2
3
4
5
6
7
8
9
10
Absolutely

Comments

"[VB.NET] How to make and save settings" :: Login/Create an Account :: 2 comments

If you would like to post a comment please signin to your account or register for an account.

Zero1UPPosted:

The only downside to this is if you move the program, your settings will be lost. So that is something to keep in mind.

TomPosted:

shit man you put a lot of work into your tuts man. nice work.