Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
item.Text = If(jResults2("items")("item") Is Nothing, "", jResults2("items")("item")("icon").ToString())
我正在使用此代码,因此如果 json 中不存在项目,它将继续但是当项目确实出现在 json 中时,它仍然设置“”值而不是 json 提供的值
你的代码看起来不错。要在运行时更仔细地检查它,请尝试在调试模式下运行您的应用程序,在该代码行放置断点。然后在 VS 的监视窗口中查看以下每个表达式返回的值:
jResults2("items")("item")
jResults2("items")("item") Is Nothing
jResults2("items")("item")("icon").ToString()
有了它,您就可以确定发生了什么。训练你的调试技巧,这将有很大帮助。