Article Options
Premium Sponsor
Premium Sponsor

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:
Add controls to the form

That's all the settings we need for this tutorial so save your changes. Close the Settings Window and set focus back to the Form1 Designer Window.

Add a TextBox to the form and stretch it almost the entire width of the form. Now select the form itself and double-click to open the code window for the Form1_Load event. Type the following code inside the Form1_Load event:


Me.BackColor = My.Settings.DefaultFormColor

Me.TextBox1.Font = My.Settings.DefaultFont

Me.TextBox1.ForeColor = My.Settings.DefaultFontColor

Me.TextBox1.Text = My.Settings.DefaultName


Press F5 to see your progress in action. You should have a form that looks similar to the following image:

Sponsored Links