IHtmlDocument TroubleShooting

C

Curtis

I am trying to debug my application which is a web scrapping application. I randomly get error will my code is processing web pages. For example I get this error:

An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in
WebClient.exe

Additional information: Exception from HRESULT: 0xC0000005.

I am using HttpWebReponse/Request to retrieve html documents so I load them into an IhtmlDocument2 by using the following declaration and then code:
Dim myDoc As mshtml.IHTMLDocument2 = New mshtml.HTMLDocument
myDoc.close()
myDoc.open("about:blank")
'write the HTML to the document using the MSHTML "write" method...
Dim clsHTML() As Object = {pHTML}
myDoc.write(clsHTML)
clsHTML = Nothing

It has been previously suggested that processing shouldn't continue with the document until it is completely loaded. I know the status of an IhtmlDocument2 can be obtained by viewing the ..IHTMLDocument2.readyState. When I view my code through the debugger the ready state changes from loading to interactive after I write content to the html but it never changes to complete. Does anyone know why this would be and what I should add to my code to fix this problem.

Thank you in advance,
Curtis
 
C

Curtis

Thanks for the example Cor but I already have my app built I am just trying
to figure out why it randomly gives me the error I mentioned in my previous
post. Any help as to why that errror might occur would be greatly
apperciated.

Thanks,
Curtis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top