use*_*524 0 c# nullreferenceexception
前几天我遇到了一些问题,我的界面滞后,在询问有人建议使用using语句来处理webbrowser.
现在实施后我不断得到:
用户代码未对NullReferenceException进行处理 - 未将对象引用设置为对象的实例.
我有一个奇怪的问题,因为即使我正在运行与另一个无关的代码,我仍然在那里得到null引用错误,这是没有意义的.
这是我的代码示例:
using (System.Windows.Forms.WebBrowser webBrowser1 =
new System.Windows.Forms.WebBrowser())
{
// issue happens here
if (webBrowser1.Url.AbsoluteUri.Contains("/signup"))
{
// rest of the code
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5829 次 |
| 最近记录: |