Error getting html from webbrowser control

kill4

Newcomer
Joined
Oct 1, 2009
Messages
5
ok, i'm having some problems getting the html source from my webbrowser control. I'm trying to get the source in the DocumentCompleted event of the webbrowser. The code i'm using is this

Dim myHTML As String = wbNav.DocumentText
Debug.Print(myHTML)

When the vb.net hits that line i get this error "The system cannot find the file specified. (Exception from HRESULT: 0x80070002)" it's a FileNotFoundException error. I've searched google, and everyone says to use this code. But it's just not working out for me. Is there another way to get the html? or is something wrong with this code?
 
If you look at the call stack (enable "Show External Code"), in what method is the exception being thrown? Or maybe just copy/paste the call stack. I don't know if the error is related to a file cacheing issue or what, but that kind of info can help.
 
> Creator.exe!WindowsApplication1.frmCreator.wbNav_DocumentCompleted(Object sender = {System.Windows.Forms.WebBrowser}, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e = {System.Windows.Forms.WebBrowserDocumentCompletedEventArgs}) Line 47 + 0x18 bytes Basic

I'm pretty new to vb.net programming so bare with me :) This was output in the call stack window. Sorry for the late response. I like your avatar meatwad is the man, lol, i actually have a meatwad avatar in another forum i post on.

Thanks..
 
Well I finally got it to work. with the code below

Code:
Dim myHTML As String = wbNav.Document.Body.InnerHtml
Debug.Print(myHTML)

Just thought i would post a update i know people come here via google, searching for a answer to this question so :)

All i did was change
Code:
wbNav.DocumentText
to
Code:
wbNav.Document.Body.InnerHtml

And all was good.
 
Back
Top