Solved

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

Posted on 2003-10-23
5
303 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

739 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