This is not managed, is it?
Main Topics
Browse All TopicsGiven a URI, I need to be able to traverse the HTML DOM, and based on its contents, return a general description of the web page as an enumerated type.
How do I get the HTML DOM in VB.Net? I could use the web browser control, Navigate to the URI, then use the Document property to instantiate am HTMLDocument object. The problem is that the Document property cannot be used until Navigated event is triggered. This means either:
1. I create an event handler for Navigated. However, that would put control to that event handler. The method that called Navigate is the one that needs the HTML DOM. How can the calling method get the HTML DOM from the event handler?
2. I can Navigate to the URI, then do a while loop until the web browser object's ReadyState property is "Loaded" (or "Complete"). This approach seems to do no good as it just seems to loop infinitely. Plus, it seems very un-event driven programming to me.
Lastly, is the web browser control the only way I can get the HTML DOM?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: rachitkohliPosted on 2008-08-19 at 03:23:13ID: 22258437
You can use the HTML object library. Add a reference to MSHTML.TLB file.
http://www .YourSite. com/", "null")
ENT_ID")
Then you can access various html objects such as Table, Row, Cell, etc.. A sample example of this could be :
Dim tb As HTMLTable '
Dim ht As New HTMLDocument
Dim htNew As HTMLDocument
Dim td As HTMLTableRow
Dim tc As HTMLTableCell
Dim strData As String
Set htNew = ht.createDocumentFromUrl("
While htNew.readyState <> "complete"
DoEvents
Wend
Set tb = htNew.getElementById("ELEM
For Each td In tb.rows
For Each tc In td.cells
strData = strData & "====" & tc.innerText
Next
Debug.Print strData
strData = ""
Next