Solved

Reading a Hyperlink on a Web Page

Posted on 2002-06-03
5
144 Views
Last Modified: 2007-12-19
Hi Experts,

This is what i am trying.
Through a VB Program, i want to open a browser, and go to a perticular web page on the Internet. For eg i open
http://www.google.com/search?hl=en&ie=UTF8&oe=UTF8&q=Mohit

Now i want to go to the web page which is the first Hyperlink of the Search result.

Can i do this

Meaning the Link will say "Mohit Gupta's Homepage"
and the source will be say "www.mohit.com"

Can i get the source code i.e. "www.mohit.com"
through the VB Program - or can i some how go to this web page through my VB program.

I will be greatful if you can help me in achiving this.

Thanks a bunch in anticipation!!!!

Regards
Mohit
0
Comment
Question by:mbgupta
5 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 200 total points
ID: 7051322
using webbrowser control you could do something like:

WebBrowser1.Navigate "http://www.google.com/search?hl=en&ie=UTF8&oe=UTF8&q=Mohit"

While WebBrowser1.Busy
    DoEvents
Wend

strLink = WebBrowser1.Document.Links(10) '' link 10
MsgBox strLink

then you can do:
webbrowser1.navigate strLink
0
 
LVL 1

Expert Comment

by:Toad224
ID: 7052636
You might be interested in looking at the Microsoft Internet Transfer ActiveX control.  With the control, you could easily get the contents of a webpage.  ie:

Dat = Inet1.OpenURL("http://www.google.com/search?hl=en&ie=UTF8&oe=UTF8&q=Mohit")

Dat would be the HTML information on the page.  You can then parse the Dat, and find the first search result link.

I hope this helps.  Good luck!
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7054293
I am more or less with Bobbit but for second approach, you could use HTML Object library to do it (parse stuff) and you get the advantage of Object model.
0
 

Author Comment

by:mbgupta
ID: 7056170
Thanks very much!!!
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7056606
your welcome :)
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

827 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