Solved

Reading a Hyperlink on a Web Page

Posted on 2002-06-03
5
141 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks very much!!!
0
 
LVL 18

Expert Comment

by:bobbit31
Comment Utility
your welcome :)
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now