How to Read Source Code of Web Page in VB.Net

0
37

This tutorial is all about How to Read Source Code of Web Page in VB.Net. With this tutorial you can Read Source Code of Web Page in VB.Net easily. So let’s get started:

  • First is open the Visual Basic, Select File on the menu, then click New and create a new project.

  • Then a New Project Dialog will appear. You can rename your project, depending on what you like to name it. After that click OK

  • Design your form like this just like what I’ve shown you below.
    Add a Webrowser, Button and Textbox.

 

  • Add this code to the button.
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2. 'when button1 cliked, webbrowser is navigated to the page
    3. WebBrowser1.Navigate("http://www.youtube.com")End Sub
  • When page is downloaded, page source will be displayed through DocumentCompleted Event then Add this code:
    1. Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
    2. 'When webbrower finish opening the page, source page is diplayed in text box
    3. TextBox1.Text = WebBrowser1.DocumentText
    4. End Sub
  • Finally, Click F5 to run Project.
  • Output:

If you have any comments or suggestion about on How to Read Source Code of Web Page in VB.Net, Please Feel Free to contact our webpage.

Download How to Read Source Code of Web Page in VB.Net Code Here

Other articles you might read also:

 

 

Facebook Comments
(Visited 38 times, 1 visits today)

LEAVE A REPLY

Please enter your comment!
Please enter your name here