Get List of All Links on a Web Page in VB.Net

0
39

This Tutorial is all about Get List of All Links on a Web Page in VB.Net. In this tutorial you will be able to Get List of All Links on a Web Page in VB.Net. So lets 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

  • After that, design your form like this just like what I’ve shown you below.
    Add a Webbrowser, a Button, a Textbox and a Label to the form.
  • Change the Webbrowser Url Properties to the page you want to get its links: (ex: http://www.google.com).
    In this tutorial, we will get the links on Google page.
  • 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. Dim a As Integer
    3. Dim b As String
    4. For a = 1 To WebBrowser1.Document.Links.Count - 1
    5. b = b & WebBrowser1.Document.Links(a).InnerHtml & vbCrLf
    6. NextTextBox1.Text = b
    7. Label1.Text = WebBrowser1.Document.Links.Count & " links."
    8. End Sub
  • Finally, Click F5 to run the Program.
    Output:

If you have any comments or suggestions about on Get List of All Links on a Web Page in VB.Net, please feel free to contact our webpage.

Download Get List of All Links on a Web Page in VB.Net Here

Other Articles Readers might read:

 

Facebook Comments
(Visited 37 times, 1 visits today)

LEAVE A REPLY

Please enter your comment!
Please enter your name here