Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2003-10-23
5
Medium Priority
?
311 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 400 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 1400 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 200 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

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 …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

824 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