然后分离加入文本和数据

时间:2014-12-18 15:02:21

标签: vb.net

我有这段代码

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
    WebBrowser2.ScriptErrorsSuppressed = True
    WebBrowser2.Navigate("http://www.fakenamegenerator.com/")
    WaitForPageLoad2()
    Dim usernme As String
    Dim password As String
    Dim first As String
    Dim last As String
    Dim addrs As String
    Dim city As String
    Dim postal As String
    Dim state As String
    Dim email As String
    Dim full As String
    Dim fullstat As String
    Dim docum As HtmlElementCollection = WebBrowser2.Document.GetElementsByTagName("div")
    For Each CurElement As HtmlElement In docum
        If CurElement.GetAttribute("classname") = "address" Then
            full = CurElement.InnerText
            MsgBox(full)
        End If
    Next
    ListBox1.Items.Add(full)
End Sub

我试图获得第一个/最后一个和最后一个/地址/状态/邮政编码我无法包围我的头b顺便说一下,因为当我从伪名称生成器中获取信息时它来了所有人都像Steven N. Henry 1203 Benson Park Drive Oklahoma City,OK 73109 请帮忙:)谢谢

1 个答案:

答案 0 :(得分:0)

如果我理解你的问题,你应该能够:

    Dim splitArray = full.Split(" ")
    For each str in splitArray
            listbox1.Items.Add(str)
    Next