Solved

Using VB to download HTML page.

Posted on 2002-06-03
4
160 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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…

895 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

14 Experts available now in Live!

Get 1:1 Help Now