以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  老师帮我查一下错在哪里?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=188631)

--  作者:ZJZK2018
--  发布时间:2023/10/7 16:06:00
--  老师帮我查一下错在哪里?
老师帮我查一下错在哪里?

Dim web As New System.Windows.Forms.WebBrowser()
web.ScriptErrorsSuppressed = True   \'解决网页页面的脚本错误提示
\'web.Navigate(blwz)
web.Navigate("https://ggzy.zj.gov.cn/art/2023/9/26/art_1229682723_232663.html")
Do Until web.ReadyState = 4 AndAlso web.Document.GetElementById("zoom") IsNot Nothing
    Application.DoEvents   \'绘制控件的代码即刻生效
Loop
Dim elems As object

\'\'\'\'--------------生成临时表----------------+
elems = web.Document.GetElementById("zoom").GetElementsByTagName("tr")(1).GetElementsByTagName("td")
\'增加临时表并设置列名
Dim dtb As New DataTableBuilder("加载网页数据")
For i As Integer = 0 To elems.Count - 1
    dtb.AddDef(elems(i).InnerText, Gettype(String), 250)
Next
Dim dt As DataTable = dtb.Build(True)
\'tb1.DataSource = dtb.BuildDataSource

\'加载明细
elems = web.Document.GetElementById("zoom").GetElementsByTagName("tr")
Dim ndr As DataRow
For n As Integer = 2 To elems.Count - 1
    Dim tds = elems(n).GetElementsByTagName("td")
    ndr  = dt.AddNew()
    For tn As Integer = 0 To tds.Count -1
        \'ndr(tn) = tds(tn).InnerText

        Output.Show(tds(tn).InnerText)
    Next
Next


图片点击可在新窗口打开查看此主题相关图片如下:1695.jpg
图片点击可在新窗口打开查看




--  作者:有点蓝
--  发布时间:2023/10/7 16:42:00
--  
这里不提供网页抓数据的技术支持,请自行解决。