rickmmrr Posted October 26, 2006 Posted October 26, 2006 Hi All, I need to be able to parse the settings in app.config and change some of them. Then have .NET persisit the changes back to the user.config file since the properties I want to change are user scope. Below is the approach I am taking. // Get the properties object Properties.Settings appSettings = ProgramName.Properties.Settings.Default; // Get the properties collection SettingsPropertyCollection SettingsCollection = ProgramName.Properties.Settings.Default.Properties; // get a couple of property objects from the collection System.Configuration.SettingsProperty Day = zeusSettingsCollection["The_Day"]; System.Configuration.SettingsProperty Year = zeusSettingsCollection["The_Year"]; // change the values Day.DefaultValue = "Set in Program"; Year.DefaultValue = "Set in Program"; // save the changes appSettings.Save(); This is not working. Thanks in advance. Quote
rickmmrr Posted October 27, 2006 Author Posted October 27, 2006 Solved All I had to do was this ProgramName.Properties.Settings.Default[Key] = Value; ProgramName.Properties.Settings.Default.Save(); Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.