Solved

Saving app configuration settings

Posted on 2013-11-23
1
217 Views
Last Modified: 2013-11-23
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.Default.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.Default.Team = "My team";
Properties.Settings.Default.save();

But when I try to set the value I get this error:  Error      5      Property or indexer 'GameCenter.Properties.Settings.Team' cannot be assigned to -- it is read only      D:\Programs\GameCenter\GameCenter\GCSettings.cs      57      13      GameCenter

I have tried using Configuration = config = ConfigurationManager.OpenExeconfiguration(. . .) 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?
0
Comment
Question by:lizmarc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 300 total points
ID: 39672162
There are 2 types of settings: Application and User.

Application settings are designed to be fixed or changed by an administrator and are thus readonly through the class that is created by the compiler and used in the application to work with the settings.

To have a read-write setting, you have to set it as a User settings, which can be done through the settings tab.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
linq, c# 8 50
What are MicroServices? 4 67
Read top line from CSV file 14 57
Run software updates from the website 6 49
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Suggested Courses

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question