Windows 窗体 UserSettings 未加载
我在名为“ExchangeRate”的 Windows 表单应用程序中创建了一个用户设置,并将其设置为“1”,然后该值在运行时更新:
Properties.Settings.Default.ExchangeRate = 1.5;
Properties.Settings.Default.Save();
但是当我重新启动应用程序时,“ExchangeRate”值重置回“1”。
在这种情况下,如何解决此问题以加载我之前设置的值“1.5”?
I have create a user setting in my Windows form application named "ExchangeRate" and set it to "1", then the value is being updated at runtime:
Properties.Settings.Default.ExchangeRate = 1.5;
Properties.Settings.Default.Save();
But when I restart the application the "ExchangeRate" value reset back to "1".
How can I fix this issue to load the value I previously set "1.5" in this case?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每次更改时都必须同步设置。
如果您更改了某个值,只需检查它是否已在 app.config 文件中更改,该文件将类似于您的 applicationname.exe.config
You have to synchronize your settings every time you change.
If you have changed a value just checked whether it has been changed in the app.config file which will be like your applicationname.exe.config