VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Reading a webpage HTML source with the WebBrowser control (and one line of code).

by m.cap (1 Submission)
Category: Internet/HTML
Compatability: Visual Basic 3.0
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating: (16 Votes)

Downloads the HTML source of a webpage using the MS WebBrowser control.

Inputs
A reference to a MS WebBrowser control
Assumes
I found many examples about how to download the HTML source of a webpage by means of the Winsock control or the Internet Transfer control, but not with the WebBrowser control. The Winsock control is too complex to me, and the Internet Transfer didn't work for me with pages larger than 5 Kb or so. I've found a one-line code that seems to work properly. I'm a sort of a newbie about this topic, so please be patient. I'm posting it just to share something that I found useful.
Code Returns
A string containing the HTML source of the web page

Rate Reading a webpage HTML source with the WebBrowser control (and one line of code).

After navigating to the desired webpage, execute the following line: 
myTextBox.Text = myWebBrowser.Document.documentElement.innerHTML

Download this snippet    Add to My Saved Code

Reading a webpage HTML source with the WebBrowser control (and one line of code). Comments

No comments have been posted about Reading a webpage HTML source with the WebBrowser control (and one line of code).. Why not be the first to post a comment about Reading a webpage HTML source with the WebBrowser control (and one line of code)..

Post your comment

Subject:
Message:
0/1000 characters