Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change in runtime application settings

I'm trying to change in runtime one key of my applications settings file, but it does not work.

I do on that way:

ConfigurationSettings.AppSettings["XPTO"] = "HELLO";

It seems that it only changes in memory, not on the file.

Does anyone knows how to do this?

Thanks.

like image 983
rpf Avatar asked Feb 13 '09 14:02

rpf


People also ask

How do I get to application settings?

From the Home screen, tap the Apps icon (in the QuickTap Bar) > the Apps tab (if necessary) > Settings .

Where are .NET application settings stored?

Settings. settings is located in the My Project folder for Visual Basic projects and in the Properties folder for Visual C# projects. The Project Designer then searches for other settings files in the project's root folder. Therefore, you should put your custom settings file there.

What are application settings?

Application settings enables developers to save state in their application using very little custom code, and is a replacement for dynamic properties in previous versions of the . NET Framework.

How do I change the default properties in C#?

To check your settings: Go to Solution Explorer > expand the Properties node of your project > double-click the . settings file. There you can create your own settings with User scope and edit it at runtime, if that is your intention.


1 Answers

Take a look at my overview of .NET settings files...In short, I think you want a user-scoped setting. It will behave more like you expect.

Edit: If you are using the settings designer in Visual Studio, then simply change the "Scope" to "User". If not, you should be able to do the equivalent programmatically.

like image 121
el2iot2 Avatar answered Oct 21 '22 06:10

el2iot2