Question Use MSHTML to get Column count in a Table

TBossAZ

Active member
Joined
Mar 31, 2009
Messages
43
Programming Experience
5-10
Hello everyone. I have been experimenting with using MSHTML to parse HTML documents, in order to retreive data from those documents. First, take a look at the following peice of code:

Code:
Dim doc As HTMLDocument = New HTMLDocument()
Dim d2 As IHTMLDocument = doc

'strHTMLCode contains the html code of the imported document
d2.write(strHTMLCode)
d2.close()

Dim tableElements As IHTMLElementCollection
tableElements = d2.getElementsByTagName("TABLE")

get the 17th table in the document
Dim oTableTest As IHTMLTable = tableElements.item(16)
Dim intRowCount as Integer = oTableTest.rows.length
Basically this code gets the 17th table in the HTML document and then is able to get a count of the rows in that table.

My question: How do I get a count of columns for the same table, I have tried oTableTest.cols, bu there is no Lenght property and the value of oTableTest.cols is 0 (zero).

Can anyone give me any ideas as to how I can get the column count for a table via MSHTML?
 
Top Bottom