Before the .NET Framework application settings were saved in INI files and the Windows Registry. But the .NET Framework introduced a much easier way using an XML file. The file has the name of the Assembly and a .exe.config extension, and is placed inside the application’s folder. This way is cleaner because when an application is uninstalled or deleted the end user does not have to worry about left over registry keys or INI files in the Windows directory.
Each setting has four properties: name, type, value, and scope. The type can be a data type or an object. The scope can be user or application. The main difference between them is settings with application scope are read only at run time, while settings with user scope are read/write at run time.
Creating a New Settings
To start creating new settings, from the Solution Explorer right-click on the project node and select Properties, or expand the Properties node and double-click the .setting file. And then enter the name, type, scope and value for each setting.
Manipulating the Settings
To read and save the value of a setting in C# use the Properties object. The following example uses a TextBox and 2 Buttons named newValueTextBox, displayButton and saveButton respectively.
private void displayButton_Click(object sender, EventArgs e)
//get the value of SavedSetting1 which is a string
string currentVal = Properties.Settings.Default.SavedSetting1;
MessageBox.Show("The value of SavedSetting1 is '" + currentVal + "'");
private void saveButton_Click(object sender, EventArgs e)
//set the new value of SavedSetting1
Properties.Settings.Default.SavedSetting1 = newValueTextBox.Text;
//apply the changes to the settings file
With our professional resume writing service, we produce the best possible resumes. In fact, even in this economy we have achieved over a 95% effectiveness rate!
Devmyresume.com – professional resume writing services that includes a one-on-one personal telephone interview with a Senior Resume Writer so that we can produce a powerful resume to truly make you stand out!