Solved

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

Posted on 2003-10-23
5
277 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_
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
?->

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

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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 …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now