Foxtable(狐表)用户栏目专家坐堂 → [求助]狐表取文件信息多个如何取


  共有3242人关注过本帖树形打印复制链接

主题:[求助]狐表取文件信息多个如何取

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/5/26 15:55:00 [显示全部帖子]

 要自己懂得分析,把帮助文档看一下 http://msdn.microsoft.com/zh-cn/library/system.windows.forms.htmlelement.aspx

 

Dim web As New System.Windows.Forms.WebBrowser()
web.Navigate("http://www.chinatimber.org/bj/default.asp")
Do Until web.ReadyState = 4
    Application.DoEvents
Loop


'取数据
Dim Cols() As String = { "产品","", "", "类别","规格","等级","产地","价格","单位","日期","报价企业" }

Dim elems As object
For Each tb As Object In web.Document.GetElementsByTagName("table")
    If tb.GetAttribute("bgcolor") = "#CCCCCC" Then
        elems = tb.GetElementsByTagName("tr")
        Exit For
    End If
Next

For Each elem As object In elems
    Dim tdelems As object =  elem.GetElementsByTagName("td")
    If tdelems.count > 9 Then
        Dim nr As Row = Tables("木材").AddNew
       
        Dim i As Integer = -1
        For Each tdelem As object In tdelems
            i = i + 1
            If Cols(i) > "" Then
                nr(Cols(i)) = tdelem.Innertext
            End If
        Next
    End If
Next
Tables("木材").save


 回到顶部