Solved

Using VB to download HTML page.

Posted on 2002-06-03
4
161 Views
Last Modified: 2010-05-02
In Visual C++ I know how to connect to an HTTP server and download a given page. I usually declare an internet file object, do the necessary connections and then read through the file line by line.

How would I accomplish this in Visual Basic? I need some example code, please, for a function that might take in a URL, connect to it, and then read through the source code line by line.

(This is for data mining purposes, by the way. I chose VB over VC++ because of better string handling capability).

Thanks very much!

-Dan

0
Comment
Question by:SuperMario
  • 2
4 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7051347
VB better than VC for string handling ???? Please note that i'm VB but i think VC is stronger for strings.

Anyway, simply put an INet control to your form, and do an OpenURL ( htmladdress ) to retrieve the data.

CHeers
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7051351
you can use the webbrowser control to do this:

WebBrowser1.Navigate "http://www.microsoft.com"
While WebBrowser1.Busy
    DoEvents
Wend
MsgBox WebBrowser1.Document.body.innerHTML

or
msgbox webbrowser1.document.body.innertext
0
 
LVL 3

Author Comment

by:SuperMario
ID: 7051365
Where can I find these controls?
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 50 total points
ID: 7051376
Menu Project
 -> Components
   -> check "Microsoft Internet Controls" (web browser)
   -> check "Microsoft Internet Transfer Controls" (inet)
  OK
see the components in the component toolbar

CHeers
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Write data from SQL to CSV file - position 1 61
MS Access - Capture pressed key onclick 4 33
Run code from text file in vb 1 64
vb6 connector to mongodb 2 84
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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

778 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