How to Process HTML in VB

To process native HTML in a VB program, you can use the InternetExplorer object. The following example will give you an idea about how to get started.

Set TheBrowser = _
TheBrowser.Visible = True
TheBrowser.Navigate _
‘set the browser in the top
TheBrowser.Top = 100
‘left of the user’s screen
TheBrowser.Left = 100
‘display the status bar
TheBrowser.StatusBar = True
‘open the default Search page
‘open the default Home page
‘refresh the current page
‘close the browser

The documentation for the events, methods, and properties for the InternetExplorer object can be found here.

An alternative way to do this is to use a lower-level control called the Internet Transfer Control. This object implements HTTP (the Hypertext Transfer Protocol) and FTP (the File Transfer Protocol)and lets you can connect to a site and retrieve files. This is a “lower level” approach since a web site will be retrieved as text rather than through method calls as with the InternetExplorer object. But the Internet Transfer Control avoids the overhead of the browser and lets you get at the HTML directly. Microsoft’s Jeffrey Richter wrote this article about it for MIND Magazine back in 1996 and this article is a friendlier introduction. Note that the Jeffrey’s MIND article suggest that you have to access the control through the WIN32 API. This is no longer the case and in VB 6, you can add the component using the Components menu item on the Project Menu. The name of the ActiveX OCX is msinet.ocx.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s