如何在没有id的情况下输出html <span>文本? VB </跨度>

时间:2014-07-19 10:16:52

标签: html vb.net web output

所以这是我的情况:

我试图创建一个能够输出单词定义和音节的程序。 到目前为止,我已经得到了这段代码:

Imports System.Text.RegularExpressions

Public Class Form3

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    TextBox1.Text = ""
    Label1.Text = ""
    WebBrowser1.Navigate("http://www.thefreedictionary.com/")
End Sub

Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
    Button1.Enabled = True
    Button2.Enabled = True
End Sub

Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    WebBrowser1.Navigate("http://www.thefreedictionary.com/")
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    WebBrowser1.Document.GetElementById("f1word").SetAttribute("value", TextBox1.Text)

    Dim allelements As HtmlElementCollection = WebBrowser1.Document.All
    For Each webpageelement As HtmlElement In allelements
        If webpageelement.GetAttribute("value") = "Search" Then
            webpageelement.InvokeMember("Click")
        End If
    Next

End Sub

结束班

现在我希望能够将包含音节和定义的元素输出到标签中。我该怎么做?

0 个答案:

没有答案