设置变量在 VB.net 中返回不同的值!

发布于 2024-09-13 17:32:14 字数 297 浏览 3 评论 0原文

这是一个很奇怪的问题。我在应用程序设置中使用以下数据设置了一个设置变量:

  • 名称:县
  • 类型:整数
  • 范围:用户
  • >: 0

然而,当我用以下语句引用它时: MsgBox(My.MySettings.Default.county) 它会提醒 1。尽管是表单加载后第一个执行的。

This is a quite strange problem. I have set a setting variable in Application settings with following data:

  • Name: county
  • Type: integer
  • Scope: user
  • Value: 0

Yet when I reference it with this statement: MsgBox(My.MySettings.Default.county)
It alerts 1. Despite being the first to be executed as soon as form loads.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沦落红尘 2024-09-20 17:32:14

我假设 My.MySettings 位是一个拼写错误。

通常,当有人从 My.Settings 读取时看到与预期不同的值时,他们似乎正在读取 Default 而不是实际值。
我建议尝试仅使用 MsgBox(My.MySettings.county) 并查看是否返回您想要的结果。

否则,尝试删除项目的 binobject 目录,然后尝试重新编译并重新运行,看看是否可能是“卡住”的东西某处。

I'm assuming that the My.MySettings bit is a typo.

Often when someone sees a different value than they expect when reading from My.Settings, it seems to be that they are reading the Default rather than the actual value.
I'd suggest trying to use just MsgBox(My.MySettings.county) and see if that returns what you want.

Otherwise, try to delete the bin and object directories of the project and try to re-compile and re-run and see if it might be something that had gotten "stuck" somewhere.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文