VB2019 VB2017 VB2015 VB2013 VB2012 VB2010 VB2008 VB6 VB Sample Codes 中文VB About Us

lesson 23 Creating a Web Browser

Basically, everyone navigates the World Wide Web using Google Chrome, Internet Explorer, FireFox, Safari, Opera and more. However, isn’t it cool if you can create your very own web browser that you can customize to your own taste? Yes, you can create one in Visual Basic 2013, and pretty easy too. In this lesson, you shall learn how to create a simple web browser and get it running in a few minutes.

First, start a new project in Visual Basic 2013 IDE and name it with any name you like. Here we use the name MyWebBrowser. Change the size of Form1 to 800,600 in its properties window. Next, you need to add an engine so that your web browser can connect to the Internet.

The engine is the WebBrowser control, located on the Toolbox on the left side, set its size property to 600,400 and change its name to  MyWebBrowser . Next, insert a text box and place it at the top of the WebBrowser control, this serves as the address bar where the user can enter the URL. Next, place a button beside the text box and change its text to GO and change its name to BtnGo. Finally, add a few more buttons and change their texts to Home, Back, Forward, Refresh and Search respectively.

The WebBrowser control comprises various methods like GoHome, GoBack, GoForward, Search, Refresh, Navigate and more. They can be used to write event-driven procedures for the various navigation buttons we place on the web browser. For the Navigate method,  we use the following syntax:


The Code

Private Sub BtnGO_Click(sender As Object, e As EventArgs) Handles BtnGO.Click
End Sub

Private Sub BtnSearch_Click(sender As Object, e As EventArgs) Handles BtnSearch.Click
End Sub

Private Sub BtnHome_Click(sender As Object, e As EventArgs) Handles BtnHome.Click
End Sub

Private Sub BtnBack_Click(sender As Object, e As EventArgs) Handles BtnBack.Click
End Sub

Private Sub BtnForward_Click(sender As Object, e As EventArgs) Handles Button1.Click
End Sub

Private Sub BtnRefresh_Click(sender As Object, e As EventArgs) Handles BtnRefresh.Click
End Sub

The Browser Interface


Figure 23.1

❮ Previous lesson Next lesson ❯

Copyright©2008 Dr.Liew Voon Kiong. All rights reserved |Contact|Privacy Policy