lizmarc
asked on
Saving app configuration settings
I use the Settings tab of the Projectt Properties page (VS 2012, C#) to create application configuratioon settings. I can read them just fine in code. But when I try to modify them I get an error. Because I'm using the settings tab, I can write code like this to read settings fine.
string team = Properties.Settings.Defaul t.Team;
where Team is a setting I made. According to MSDN, I should be able to modify then save settings in code like this.
Properties.Settings.Defaul t.Team = "My team";
Properties.Settings.Defaul t.save();
But when I try to set the value I get this error: Error 5 Property or indexer 'GameCenter.Properties.Set tings.Team ' cannot be assigned to -- it is read only D:\Programs\GameCenter\Gam eCenter\GC Settings.c s 57 13 GameCenter
I have tried using Configuration = config = ConfigurationManager.OpenE xeconfigur ation(. . .) and then working with the appsettings.settings stuff but I can't even read doing that because I think I'm using the prefered newer way of handle configuration. Any thoughts on why I can't write back to the app.config file?
string team = Properties.Settings.Defaul
where Team is a setting I made. According to MSDN, I should be able to modify then save settings in code like this.
Properties.Settings.Defaul
Properties.Settings.Defaul
But when I try to set the value I get this error: Error 5 Property or indexer 'GameCenter.Properties.Set
I have tried using Configuration = config = ConfigurationManager.OpenE
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.