Can I change the value in the settings.setting file?

I am working on a Windows Form Application from C # and it would be very helpful if I could change the value in the settings.setting file in the program properties. Actually I want to put the connection string for the SQL database in this file and get it when needed, so I need to change it if the connection changes.

+2


source to share


2 answers


There are two types of settings: Application area and User area. You can always change the user scope settings (like in @Alans' answer), but admin rights are required to change the application scope. The basic idea is that application area settings are only editable by the administrator (using Notepad or whatever).



Explanation: The settings are stored in \Program Files\App\App.exe.config

and you need to be an administrator to write in \Program Files

(under Vista or limited XP). Custom settings are saved in the "User Settings" folder, installed .config

contains only the default value.

+1


source


You can change the value and then call: Properties.Settings.Default.Save();



0


source







All Articles