Article Options
Premium Sponsor
Premium Sponsor

 »  Home  »  .NET Newbie  »  Creating, Using and Saving My.Settings Default Values in Visual Basic 2005  »  Adding User Scope Settings
 »  Home  »  Visual Studio 2005  »  Creating, Using and Saving My.Settings Default Values in Visual Basic 2005  »  Adding User Scope Settings
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:
Adding User Scope Settings

 

Fill in the following properties for the first Setting:

Name: DefaultFont

Type: System.Drawing.Font

Scope: User

In the Value column press the ellipse (...) button. Since you have chosen 'font' as the setting type, the Font Dialog opens. Use the following font settings:

Font: Microsoft Sans Serif

Font Style: Italic

Size: 12

Script: Western

 

Create three more Settings. For the first, use the following property settings:

Name: DefaultFontColor

Type: System.DrawingColor

Scope: User

For the Value you can type, or choose the color itself. Use the color 'Navy'.

 

For the second setting, use:

Name: DefaultFormColor

Type: System.DrawingColor

Scope: User

Value: Lavender (Found under the 'Web' color tab)

 

For the third setting, use:

Name: DefaultName

Type: String

Scope: User

Value: 3-bSoftware.com

 

 

Your Settings should look like the image above.

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