We are delveloping C# windows based application .net 4 environment.In My application, i want to update settings file(app.config) attribute programatically.Actually we created one user interface(textbox).So, User will enter the new configuration information in the textbox.When clicking the save button, i want to update this value in settings file permanently.
for example:
I have Encryption Key in my settings file.Suppose, user may enter the new encryption key using that interface,then it will automatically update the settings file Encryption key value.
Is this possible?
First of all you have to add this reference :
System.Configuration, then you can write toapp.configfor example with this code :Bear in mind that you have to create the app.config file before with the Visual studio wizard, in this example i have called the field for the encryption key :
EncryptionKeyand the related textbox in the form :textBoxKey.