winforms - winform 的应用程序设置 : cannot save application settings which has been added during the run time

标签 winforms save application-settings

我在运行时保存应用程序设置时遇到了一些问题...

如果我将设置范围更改为用户,它可以正常工作,但在应用程序范围内,什么也没有发生......

我用过:

Properties.Settings.Default.Save();

有任何想法吗 ?

谢谢

最佳答案

那是因为将范围设置为 Application 使其成为只读的。

Using Settings in C#

Application-scope settings are read only, and can only be changed at design time or by altering the .exe.config file in between application sessions. User-scope settings, however, can be written at run time, just as you would change any property value. The new value persists for the duration of the application session. You can persist changes to user settings between application sessions by calling the Settings.Save method.

关于winforms - winform 的应用程序设置 : cannot save application settings which has been added during the run time,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9617236/

相关文章:

c# - 存储应用程序设置 |注册表

c# - 在我的程序中保存和加载设置的最佳方式是什么?

c# - 是否有可能在 C# Winforms 中使用 MetroUI?

c# - 如何在不重新安装的情况下更新winform应用程序

c# - 如何将字符串传递给 UWP 应用程序并从 Windows 窗体应用程序启动它

java - 每次打开应用程序时,在 Android sdcard0 中动态保存 .text 文件

python - 在循环中使用不同的名称保存数组

multidimensional-array - 如何将NxNxN数组(或矩阵)保存到Julia(或Python)文件中?

iPhone 设置 : create dependent settings?

c# - 如何在 .NET 中验证后将焦点设置到控件