System.Windows.Forms.HtmlElement'无法转换为布尔值

时间:2015-06-28 23:35:30

标签: vb.net

我在vb.net中有错误。 //更新:我改变了代码。 我怎样才能将这个值( Answer )放到vb.net应用程序中? <input type="text" name="first_name" id="first_name" value="*Answer*" class="regular-text">

Private Sub WebBrowser2_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser2.DocumentCompleted
    Dim elementcollection As HtmlElementCollection = WebBrowser2.Document.All
    For Each element As HtmlElement In elementcollection
        If element.GetAttribute("classname").Contains("username") Then
            MetroLabel3.Text = element.InnerText
        End If
        If element.GetAttribute("value").Contains("first_name") Then
            bilgi2.Text = element.InnerText
        End If
    Next
End Sub

1 个答案:

答案 0 :(得分:-1)

我不认为

WebBrowser2.Document.All

返回您期望的类型。