读书人

网页上的table表格小弟我用webbrows

发布时间: 2012-05-22 18:18:54 作者: rapoo

网页上的table表格,我用webbrowser控件操作时遇到的问题?

VB.NET code
        Dim kkk As mshtml.IHTMLDocument        ' Dim div As mshtml.HTMLDivElement        kkk = WebBrowser1.Document.Window.Frames("pagearea").Frames(2).Document.DomDocument        Dim col As mshtml.IHTMLTable        Dim tablerow As mshtml.IHTMLTableCell        ' Dim cel As mshtml.HTMLTableCell        col = kkk.getElementById("tabList2")        tablerow = col.rows(0)


tablerow = col.rows(0)这句提示错误:没有默认属性,因此不能被索引,我想引用这个表的行,该如何解决?

[解决办法]
不是没人要分,而是很少有人用webbrowser去操作html table
给code,自己研究一下
Dim range As IHTMLControlRange = CType(document.selection.createRange, IHTMLControlRange)
Dim f As mshtml.HTMLTable = CType(range.item(0), mshtml.HTMLTable)
For Each r As mshtml.HTMLTableRow In f.rows
'遍历行
For Each c As mshtml.HTMLTableCell In r.cells
'遍历列
Next
Next

读书人网 >VB Dotnet

热点推荐