Author: Lord Nikon
Date: October 8, 2005
Visual Basic is the most popular and most widely used programming language, basically because it's so easy and has design mechanisms. In this tutorial I will explain how to make a simple browser.
Start up VB6 and make a Standard EXE and click CTRL+T and in the components window's control tab scroll down to select Microsoft Internet Controls and check it. Press OK.
Now in the toolbar there should be new icon like below:

Click on it and make a control on the form as big as you want. Then these controls:
Control name
text box txturl
command button cmdgo
command button cmdback
command button cmdforward
command button cmdrefresh
So it should like this when you run it:

Double click on the command "Go" and add this code:
Private Sub cmdgo_Click()
WebBrowser1.Navigate (txturl.Text)
End Sub
This will make the browser navigate to the address the user entered in txturl. Simple enough.
Click on the the cmdback button and add this code:
Private Sub cmdback_Click()
WebBrowser1.GoBack
End Sub
Click on the Forward button and add this code:
Private Sub cmdforward_Click()
WebBrowser1.GoForward
End Sub
This is self explanitory.
Click on the cmdrefresh button and add this code:
Private Sub Command3_Click()
WebBrowser1.Refresh
End Sub
Also self explanitory.
Now you can do more complex things with the browser: Like making a button go to a certain URL, you would add this code:
Private Sub cmdgoogle_Click()
WebBrowser1.Navigate ("http://aphnetworks.com")
End Sub
This will make the browser navigate to aphnetworks.com.
Note to use Wndows Internet Control you need shdocvw.dll in the system32 folder, but most computers come with it. If you don't see it in the components list, download it from a website.
|