设置变量在 VB.net 中返回不同的值!
这是一个很奇怪的问题。我在应用程序设置中使用以下数据设置了一个设置变量:
- 名称:县
- 类型:整数
- 范围:用户
- 值 >: 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设
My.MySettings
位是一个拼写错误。通常,当有人从
My.Settings
读取时看到与预期不同的值时,他们似乎正在读取Default
而不是实际值。我建议尝试仅使用
MsgBox(My.MySettings.county)
并查看是否返回您想要的结果。否则,尝试删除项目的
bin
和object
目录,然后尝试重新编译并重新运行,看看是否可能是“卡住”的东西某处。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 theDefault
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
andobject
directories of the project and try to re-compile and re-run and see if it might be something that had gotten "stuck" somewhere.