Solved

Reading a Hyperlink on a Web Page

Posted on 2002-06-03
5
143 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…

809 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