Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleList the links available at a URL
Keywordslinks, URL, Web
CategoriesUtilities, Controls, Internet
 
Open the URL with the WebBrowser control. Use its Document object's links collection to list the links.

Using a similar technique you can look at the Document object's other properties.

 
Private Sub cmdListLinks_Click()
Dim i As Integer

    cmdListLinks.Enabled = False
    Screen.MousePointer = vbHourglass
    DoEvents

    ' Open the URL.
    wbrSource.Navigate txtURL.Text

    ' Wait until the document is loaded.
    Do While wbrSource.ReadyState <> READYSTATE_COMPLETE
        DoEvents
    Loop

    ' List the links available.
    lstLinks.Clear
    For i = 0 To wbrSource.Document.links.length - 1
        lstLinks.AddItem wbrSource.Document.links(i).href
    Next i

    ' Reenable the button.
    cmdListLinks.Enabled = True
    Screen.MousePointer = vbDefault
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated