Solved

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

Posted on 2003-10-23
5
307 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month6 days, 13 hours left to enroll

623 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