VBA to VB.Net translation: Working with IE
I'm trying to create a vb.net program to parse an HTML doc that is in a
webbrowser control. Basically, I need to find the specified table (by
class) and then go row by row checking the 5 and 6th columns against
certain criteria.
Dim eles As HtmlElementCollection 'Stores contents of html document
eles = iexplore.Document.GetElementsByTagName("table")
'Get table with tasks
For Each he As HtmlElement In eles
MsgBox(Len(he.Children))
If he.GetAttribute("class") = tclass Then
'what to do when we have the table
End If
Next
The problem is that it's throwing an exception: Object reference not set
to instance of an object
I thought that's what I was doing by assigning an htmlcollection to eles
with the line:
eles = iexplore.Document.GetElementsByTagName("table")
If this is wrong, what is the correct way to do this?
No comments:
Post a Comment