In this tutorial we will create a simple web browser in visual basic. There is a tool called ‘WebBrowser’ in the toolbox that is specifically designed to output web pages. After adding a WebBrowser we are able to access it’s class methods, which includes a search method and many more. At the conclusion of this tutorial you will have a basic web browser and if you work more on it, you can create something special.

Setting Up

If you have not done so already, set up a project using a windows form application. Open visual studio and click File > New > Project. Expand Other Languages > Visual Basic and click on Windows. Select Windows Forms Application and name it Web Browser. Click OK.

Web Browser 1

Web Browser 2

Your solution explorer should look similar to the screen shot on the left and your form should look like the one on the right.

Step One

We will add a tool strip item that conveniently places items that we need in a browser at the top of the form. Expand the ‘Toolbox’ panel and find the ToolStrip item. Drag it onto the from and it will automatically wrap itself at the top of the form. Most popular browsers today have buttons at the top of the form, and this browser will be no different. Now again in the Toolbox panel, look for the WebBrowser item and place it in the form. Now the form has a white box and a scroll bar in the web browser area on the form.

Web Browser 3

Step Two

Now we need to add the tools for the web browser. we can do this via the tool strip we added on the form. Click on the tool strip at the top to focus it and click on the drop down list and select TextBox. This text box will be used to enter a URL of a web site, basically the address bar. In its property window, change the ‘(Name)’ to txtUrl.

In the drop down list select a Button item. This will be used as our search button. In the properties window, change ‘(Name)’ to btnGo and the ‘Text’ to GO. Also it is important to change its ‘DisplayStyle’ to Text as this will appear on the form.

Add another button from the tool strip and change the ‘(Name)’ to btnStop. Change the ‘Text’ to STOP and the ‘DisplayStyle’ to Text. This button will stop a page from loading.

Add a final button and change the ‘(Name)’ to btnRefresh. Change the ‘Text’ to REFRESH and the ‘DisplayStyle’ to Text. This button will refresh a page.

Web Browser 4

Step Three

Now that we have the buttons and layout of the browser, we can start adding code that takes advantage of the WebBrowser class methods. Double click on the ‘GO’ button to open Form1.vb. Type in WebBrowser1.Navigate(txtUrl.Text) inside the ‘Private Sub btnGo_Click’ event handler.

Go back to Form1′s design and double click on the ‘STOP’ button. Inside the ‘Private Sub btnStop_Click’ event handler, insert WebBrowser1.Stop().

Repeat one more time but this time for the ‘REFRESH’ button. Inside the ‘Private Sub btnRefresh_Click’ event handler insert WebBrowser1.Refresh().

All of the browser methods used come from the WebBrowser class, there are quite a bit and you should experiment with them at the conclusion of this tutorial.


Save and run the application. Type in into the address bar and click the ‘GO’ button. The page should pop up. Try entering other web sites and see how it looks and functions in your homemade browser. This is a fun project that if you dedicate yourself to learning more about the other features in the WebBrowser class, you can have your own personal browser to use on your computer! Get creative and have fun making your web browser.

Download Source Files