老师帮我查一下错在哪里?
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