NullReferenceException是未处理的Webbroswer VB

时间:2015-06-22 09:01:36

标签: .net

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


    WebBrowser1.Document.GetElementById("searchField").SetAttribute("value", "SalesRecordNumber")   ' Change Dropdown To "Sales Record Number"
    WebBrowser1.Document.GetElementById("searchValues").InnerText = TextBox1.Text   ' Set The Search Value To Textbox1
    WebBrowser1.Document.GetElementById("searchbutton").InvokeMember("click")       ' Click On The Search Button

    Dim yourObj As HtmlElement = (From ele As HtmlElement In WebBrowser1.Document.GetElementsByTagName("a") Where ele.InnerText = TextBox1.Text Select ele).FirstOrDefault
    yourObj.InvokeMember("click")  ' Select The Sale Record Number
End Sub

在yourObj的点击中,我得到一个"未处理的类型' System.NullReferenceException'""错误

0 个答案:

没有答案