Visual Basic 2017 Lesson 23: Creating a Web Browser

[Lesson 22] << [Contents] >> [Lesson 24]

Which browser do you use to surf the Internet? Basically everyone likes to navigate the Internet 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 do that in Visual Basic 2017, and pretty easy too. In this lesson, we shall learn 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 2017 and name it with any names you like, we are using 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, and this very 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 .

The next step is to insert a text box and place it at the top of the WebBrowser control, this will be served as the address bar where the user can enter the URL. Next, place a button beside the text box and change its text as 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

vb2013_figure23.1Figure 23.1

 [Lesson 22] << [Contents] >> [Lesson 24]

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInPin on PinterestShare on Tumblr