Article Options
Recently Viewed
Premium Sponsor
Premium Sponsor

 »  Home  »  .NET Newbie  »  Creating, Using and Saving My.Settings Default Values in Visual Basic 2005  »  Saving Setting value changes at runtime
 »  Home  »  Visual Studio 2005  »  Creating, Using and Saving My.Settings Default Values in Visual Basic 2005  »  Saving Setting value changes at runtime
Creating, Using and Saving My.Settings Default Values in Visual Basic 2005
by Dave Barr | Published  05/29/2006 | .NET Newbie Visual Studio 2005 | Rating:
Dave Barr
Not much to tell, so for now view some of my custom logo designs, and a photograph of mine that made it to the local newspaper. 

View all articles by Dave Barr...
Saving Setting value changes at runtime

Add a Form1_FormClosing event. Type this code:

My.Settings.DefaultName = Me.TextBox1.Text

Now press F5 to run. This time, change the text in the textbox from 3-bSoftware.com to your name. Close the form. Close the project. Close Visual Studio. If you like, you can restart your computer too.

Next time you run the "VbCity Sample Project" you will see the name you just typed in the TextBox.

You can use this same process to save any of the 'User Scope' variable changes. Try practising by saving different values for the DefaultColors, or DefaultFont. Good luck!

Thank you for reading my article, Dave.

 

How would you rate the quality of this article?
1 2 3 4 5
Poor Excellent
Tell us why you rated this way (optional):

Article Rating
The average rating is: No-one else has rated this article yet.

Article rating:4.20930232558141 out of 5
 43 people have rated this page
Article Score25046
Comments    Submit Comment

Comment #1  (Posted by an unknown user on 06/01/2006)
Rating
Very clear to follow. All actions mentioned.
 
Comment #2  (Posted by an unknown user on 06/13/2006)
Rating
Thanksssssssssssssssssssssssss so much

vbapr@yahoo.com
 
Comment #3  (Posted by Mark on 06/23/2006)
Rating
What about writing an reading the settings programmatically?Can we do that?any examples would be fantastic
 
Comment #4  (Posted by an unknown user on 06/23/2006)
Rating
What about reading pages 3 and 4 where it's explained?

Page 3:
Me.BackColor = My.Settings.DefaultFormColor
Me.TextBox1.Font = My.Settings.DefaultFont
Me.TextBox1.ForeColor = My.Settings.DefaultFontColor
Me.TextBox1.Text = My.Settings.DefaultName

Page 4:
My.Settings.DefaultName = Me.TextBox1.Text
 
Comment #5  (Posted by an unknown user on 07/01/2006)
Rating
Thank You! Great and Simple.
 
Comment #6  (Posted by an unknown user on 07/02/2006)
Rating
Great!
 
Comment #7  (Posted by an unknown user on 07/03/2006)
Rating
Easy to follow, thank you.
 
Comment #8  (Posted by an unknown user on 09/01/2006)
Rating
Thanks Alot;;There is no way to change app level settings during setup/runtime ?
 
Comment #9  (Posted by an unknown user on 09/01/2006)
Rating
DAVE PASSED AWAY ON JULY 31, 2006.
 
Comment #10  (Posted by an unknown user on 10/05/2006)
Rating
My condolences, looks like a great guy. Great tutorial as well.
 
Comment #11  (Posted by an unknown user on 10/21/2006)
Rating
Thank you very much!

Johannes
 
Comment #12  (Posted by an unknown user on 11/07/2006)
Rating
The best and easiest way to save app settings! Thanks!!:D

//Fredrik Ragnarsson
SWEDEN
frrag001@hotmail.com
 
Comment #13  (Posted by an unknown user on 12/06/2006)
Rating
just a perfect example...
 
Comment #14  (Posted by an unknown user on 04/18/2007)
Rating
It really solve my problems with new Settings of VS2005!!!
 
Comment #15  (Posted by an unknown user on 05/09/2007)
Rating
Short and Clear. ThanX
Ralph
 
Comment #16  (Posted by Chris Walker on 07/12/2007)
Rating
The new way to do this in VS 2005 is to use PropertyBinding. It does the same thing, but without any code.

Add a control to a form, view the properties of that control, go to ApplicationSettings, there you will see PropertyBinding. Opent that up, pick a property, give it a new name to save the settings to, and viola, you are done.
 
Comment #17  (Posted by adult on 05/19/2008)
Rating
nice work man 10x
 
Comment #18  (Posted by rBqDvieTA on 06/05/2008)
Rating
tickets_4.txt;2;2
 
Comment #19  (Posted by rBqDvieTA on 06/05/2008)
Rating
tickets_4.txt;2;2
 
Comment #20  (Posted by KNgxTuMKXexmXSGmgTJ on 06/05/2008)
Rating
tickets_5.txt;2;2
 
Comment #21  (Posted by an unknown user on 07/10/2008)
Rating
this articles help me so much
 
Comment #22  (Posted by nick on 07/27/2008)
Rating
Toiono hi! hice site!
 
Comment #23  (Posted by nick on 07/27/2008)
Rating
qGgacq hi! hice site!
 
Comment #24  (Posted by nick on 07/29/2008)
Rating
SnhJqU hi! hice site!
 
Comment #25  (Posted by kris on 08/16/2008)
Rating
interesting post thx
 
Comment #26  (Posted by ybZBIEKbkZCiRPwhCA on 09/06/2008)
Rating
NFbKFw spam_31.txt;5;10
 
Comment #27  (Posted by an unknown user on 09/08/2008)
Rating
It was a tutorial on a specific task that was clear, concise and worked.
 
Comment #28  (Posted by an unknown user on 09/08/2008)
Rating
It was a tutorial on a specific task that was clear, concise and worked.
 
Comment #29  (Posted by john on 10/19/2008)
Rating
great work man thx
 
Comment #30  (Posted by an unknown user on 11/19/2008)
Rating
Thanks Great job, Clear and Simple :)
 
Comment #31  (Posted by an unknown user on 12/01/2008)
Rating
ricaloloer
 
Comment #32  (Posted by an unknown user on 01/16/2009)
Rating
Its very easy for dummy like me 2 understand.its fabulous
 
Comment #33  (Posted by an unknown user on 03/23/2009)
Rating
All I want to say: Thank You! :)
 
Comment #34  (Posted by cheap oem software on 02/10/2012)
Rating
gGrr15 Stupid article..!!
 
Sponsored Links