Generally, everyone surfs the net using browsers such as IE, Chrome, Opera, Safari and more. However, isn’t it cool that if you can create your very own web browser that you can customize to your own taste? Yes, you can do that in Visual Basic 2012, and pretty easy too. In this lesson, we will show you how to create a simple web browser and get it running in a few minutes.
First of all, start a new project in Visual Basic 2012 and name it with any name you like. Here I am just using the name Web Browser. Change the name of Form1 to MyWebBrowser and the text property to Web Browser and set its size property to 640,480.
The code for the web browser is surprisingly simple, it is only a single line code! Double click on the Go button and key in the following code:
Public Class Form1 Private Sub Go_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MyWebBrowser.Navigate(TextBox1.Text) End Sub End Class
Now run the program, type in any URL and click the Go button. You will be able to browse any web page you want.
Figure 19.2: The Runtime Interface