An old question, but I provide this answer to help anyone attempting to implement Simon P Stevens' answer related to the ConfigurationManager class since I wasn't sure how to do it being a novice with settings.
One of the first realizations was that the 2 Settings files in my C# project (made difficult because the typical one under Properties was there, but empty) were combined into the single .config and split between different ConfigurationSections. I thought that was why ConfigurationManager.AppSettings and ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None) both kept returning 0 keys.
It took a lot of trial and error to realize that most of the ConfigurationManager references deal with the default appSettings and that was different than applicationSettings which is what Settings uses.
I ultimately found the following:
Select the right ConfigurationSectionGroup/ConfigurationSectionClient, cast to SettingsSection, get the setting, and set the XML InnerText (e.g. below):
// this gets the applicationSettings section (and the inner section 'inoBIBooks.My.MySettings')
Configuration config = WebConfigurationManager.OpenWebConfiguration("/" + targetvdir);
ConfigurationSectionGroup applicationSectionGroup = config.GetSectionGroup("applicationSettings");
ConfigurationSection applicationConfigSection =
applicationSectionGroup.Sections["inoBIBooks.My.MySettings"];
ClientSettingsSection clientSection = (ClientSettingsSection)applicationConfigSection;
// set a value to that specific property
SettingElement applicationSetting = clientSection.Settings.Get("BIDB_Username");
applicationSetting.Value.ValueXml.InnerText = "username";
// without this, saving won't work
applicationConfigSection.SectionInformation.ForceSave = true;
// save
config.Save();
This is pulled from:
Access section 'applicationSettings' (not 'appSettings') in config file from setup
and
Save and reload app.config(applicationSettings) at runtime