Board index » Visual Studio » iterate tables collection of webbrowser control, how

iterate tables collection of webbrowser control, how

Visual Studio204
I want to load a page in a VB6 webbrowser control then iterate through

the table collections until I find the table I want, then iterate

through the table headings or table cells to collect the text.



Does anyone know of any examples of doing this?



I added a component HTML Object Library so I could use variables to

iterate through the two collections:



Dim table As HTMLTable, tablecell As HTMLTableCell



But I can't figure out how to access the tables collection,, neither of

these works:



with webbrowser1

.document.body.tables.count

.document.tables.count



TIA,

Mike


-
 

Re:iterate tables collection of webbrowser control, how

There's no tables collection, but you can

filter like this:



For i = 0 to document.all.length

If document.all(i).tagName = "TABLE" Then....





Quote
I want to load a page in a VB6 webbrowser control then iterate through

the table collections until I find the table I want, then iterate

through the table headings or table cells to collect the text.



Does anyone know of any examples of doing this?



I added a component HTML Object Library so I could use variables to

iterate through the two collections:



Dim table As HTMLTable, tablecell As HTMLTableCell



But I can't figure out how to access the tables collection,, neither of

these works:



with webbrowser1

.document.body.tables.count

.document.tables.count



TIA,

Mike





-

Re:iterate tables collection of webbrowser control, how

mayayana wrote:

Quote
There's no tables collection, but you can

filter like this:



For i = 0 to document.all.length

If document.all(i).tagName = "TABLE" Then....



Thanks!

Mike



Quote
>I want to load a page in a VB6 webbrowser control then iterate through

>the table collections until I find the table I want, then iterate

>through the table headings or table cells to collect the text.

>

>Does anyone know of any examples of doing this?

>

>I added a component HTML Object Library so I could use variables to

>iterate through the two collections:

>

>Dim table As HTMLTable, tablecell As HTMLTableCell

>

>But I can't figure out how to access the tables collection,, neither of

>these works:

>

>with webbrowser1

>.document.body.tables.count

>.document.tables.count

>

>TIA,

>Mike





-

Re:iterate tables collection of webbrowser control, how

Alexander Mueller wrote:

Quote
10.03.2007 07:57, Mike Scirocco schrieb:

>I want to load a page in a VB6 webbrowser control then iterate through

>the table collections until I find the table I want, then iterate

>through the table headings or table cells to collect the text.

>

>Does anyone know of any examples of doing this?

>

>I added a component HTML Object Library so I could use variables to

>iterate through the two collections:

>

>Dim table As HTMLTable, tablecell As HTMLTableCell

>

>But I can't figure out how to access the tables collection,, neither of

>these works:

>

>with webbrowser1

>..document.body.tables.count

>..document.tables.count



There is no tables-property for the HTMLDocument or HTMLBody-Object

or any other MSHTML-interface,

use:

Set colTables = document.getElementsByTagName("TABLE")

instead.



Then either



For Each oTable in colTables



Or



For i=0 To colTables.length - 1



to enumerate tables.

Note that getElementsByTagName and getElementsByName return 'NodeList'

resp IHTMLElementCollections which rather use 'length' then 'Count' to

return the number of items.

MSHTML is an implementation of the W3C Html-DOM whose naming-convention

is more close to Java and C++, where length is far more popular

then Count, which is more common in the microsofty world.



MfG,

Alex



Very Nice! Thanks!

Mike

-