Introduction: Create Your Own Internet Basic Browser With Visual Basic
Create a Browser: Develop your own Internet Browser
First of all you need a developer program in this case it must be Visual Basic.NET 2003 but 2005 and even 2008 will do as well as the for runner Visual Basic 6.
Now if you do not own any of these programs cheap copies could possibly be bought from ebay.com since most developers have up graded to the latest versions and would like to get rid of their old programs.
However the code differ slightly between .NET and VB6 but is basically the same other wise.
In both cases you need the following controls which is a web browser control a text box a few buttons and a link label control all part of the standard tools in your tool box except the web browser control need to be added from the reference menu to your tool box.
Start by opening your development program with a new program and you will end up with a form onto which all controls go as seen below.
You can just double click on a tool in the toolbox that would appear then automatically on the form.
I have also added a menu to the top and two buttons at the bottom however you do not need that and the coding below is for a browser with a progress bar a text box a link label a web browser control and a few buttons.
Now for each control do you have to set its various properties.
Lets take them on by one.
Buttons: In the properties window set the default text ie. Button1 to Forward for instance by high lighting and typing the new text.
Link Label Control: Same thing to URL:
Text Box: Same thing to http://www.google.com
You can also add coding to the form load event to display for instance http://www.yahoo.com when the program start up it opens the Yahoo site in the browser control window automatically.
Here is the piece of coding: AxWebBrowser1.Navigate("http://www.yahoo.com")
You need the following buttons: Go, Back, Forward, Refresh and Stop
Under the Go Button: Basically tells the computer to open the site in the text box: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click On Error Resume Next AxWebBrowser1.Navigate(TextBox1.Text) End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click On Error Resume Next AxWebBrowser1.GoBack() End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click On Error Resume Next AxWebBrowser1.GoForward() End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click On Error Resume Next AxWebBrowser1.Refresh() End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load On Error Resume Next AxWebBrowser1.Navigate("http://vegas-casino-high-roller.blogspot.com") End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click On Error Resume Next AxWebBrowser1.Stop() End Sub
Should you add a 'Exit' button: Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click On Error Resume Next Me.Close() End Sub
It is a good thing to add error handling stop the computer from freezing up if it should encounter any error.
Progress bar coding:
Private Sub AxWebBrowser1_DocumentComplete(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) Handles AxWebBrowser1.DocumentComplete ProgressBar1.Value = 100 Label1.Text = "Done" End Sub
Private Sub AxWebBrowser1_ProgressChange(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_ProgressChangeEvent) Handles AxWebBrowser1.ProgressChange
ProgressBar1.PerformStep() If ProgressBar1.Maximum = ProgressBar1.Value Then ProgressBar1.Value = 0 End If End Sub
As matter of fact you do not need a progress bar I have meerly added it to see how a website progress when busy loading.
The above coding must be added to each Button by double clicking on the button then the code window opens and you can then just simply copy and paste.
No coding is required for the web browser control and link label.
Extra coding to open a website: Under a button a link label a picture or under a drop down menu choice is yours
On Error Resume Next System.Diagnostics.Process.Start("http://world-wide-online-casinos.blogspot.com/")
Here is a download link to the browser including all source code. https://app.box.com/files/0/f/0/1/f_22725513735
An installation or Setup file can be added to any project, if you need to do it and do not know how is to read the help files.
See image of finished browser below done in Visual Basic.NET 2003.
There is however a bit of a down side with the VBNET programs is that the end user need to download the Framework files from Microsoft to make the programs work free it is. Where as with VB6 can be run straight from the zip file.
Best of Luck,
Herman Dreyer - South Africa
Email: dreyerherman123@gmail.com
http://www.herman-dreyer-free -software.blogspot.com