如何在运行时应用程序的设置更改 [英] How to change in runtime application settings

查看:118
本文介绍了如何在运行时应用程序的设置更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在运行时改变我的应用程序的设置文件的一个重点,但它不能正常工作。

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

我做这样:

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

它似乎只改变内存,而不是在文件中。

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

有谁知道如何做到这一点?

Does anyone knows how to do this?

感谢。

推荐答案

看看我的<一个href="http://stackoverflow.com/questions/481025/where-property-setting-value-stored-in-c-windows-application/481064#481064">overview .NET程序的设置文件 ......总之,我想你想一个用户范围设置。它会表现得更像你期望的那样。

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.

编辑:如果您使用的是设置设计师在Visual Studio ,则只需更改范围为用户。如果没有,你应该能够以编程方式做等价。

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.

这篇关于如何在运行时应用程序的设置更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆