Solved

Help me build Visual Basic application that searches for hyperlinks on a web page

Posted on 2003-10-23
5
295 Views
Last Modified: 2013-11-25
I need your help in building a Visual Basic application that has a webbrowser control and does the following:

1) on form load webbrowser control goes to "http://www.yahoo.com"
2) then program scans resulting page for a text hyperlink that
    - contains the word "HotJobs" as its text and
    - contains the url "http://www.yahoo.com/r/jb" as its actual hyperlink
3) if a hyperlink with the above criteria is found, the webbrowser control navigates to this link

I will only give points to the person who gives me full working source code for the above.
0
Comment
Question by:frankmorrison
  • 2
  • 2
5 Comments
 
LVL 7

Expert Comment

by:_agj_
ID: 9605217
using webbrowser control u can do:

webbrowser.navigate "http://www.yahoo.com"

in the webbrowser_document_complete() even:

do a:

string1 = webbrowser.document.innerHTML.

this should give you all the text in this page.

Now, search for the required text in string1.

Extract the URL and do a "webbrowser.navigate"
0
 
LVL 7

Assisted Solution

by:_agj_
_agj_ earned 100 total points
ID: 9605253
TRY:

Private Sub Form_Load()
WebBrowser1.Navigate "http://www.yahoo.com"
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim strHTML As String

strHTML = WebBrowser1.Document.innerHTML
If InStr(1, strHTML, "<a href=r/jb>HotJobs</a>", vbTextCompare) <> 0 Then
WebBrowser1.Navigate "http://www.yahoo.com/r/jb"
End If
End Sub
0
 
LVL 2

Assisted Solution

by:-Bender-
-Bender- earned 350 total points
ID: 9605305
Try this piece of code:

For x = 0 To WebBrowser1.Document.Links.length - 1
   List1.AddItem WebBrowser1.Document.Links.Item(x)
Next x

Each item you can check on keywords etc.
0
 
LVL 26

Accepted Solution

by:
EDDYKT earned 50 total points
ID: 9605798
I just combine the above suggestion to come up with this

don't give me pt


Option Explicit

Private Sub Form_Load()
WebBrowser1.Navigate "http://www.yahoo.com"

End Sub


Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim x
For x = 0 To WebBrowser1.Document.Links.length - 1
  If (InStr(1, WebBrowser1.Document.Links.Item(x).outerhtml, "HotJobs")) Then
  WebBrowser1.Navigate WebBrowser1.Document.Links.Item(x)
  Exit Sub
  End If
Next
 
End Sub
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9608516
?->

Sorry doesn't mean to steal pt from you guy
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question