WebBrowser Control

Going Further

However, there is much to a browser than just the browser window. You need a List box to type in the address of other websites. And you need other navigational tools such as Back and Forward Buttons.

So do you want to know how to do it, or is that it?

Now then select the combo box icon from the toolbox, and draw a combo on the form. Add a label with the caption address and place it alongside the combo box. Then go to the code windows and type the following text:

Private Sub Combo1_Click()
    WebBrowser1.Navigate Combo1.Text
End Sub

Private Sub Combo1_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
    End If
End Sub

If you did that correctly you can now navigate anywhere on the web by typing the address of the site in the combo box. Now then you can add forward and back buttons to the browser to do exactly what it says on the tin!!

Add two command buttons on the form. Call them CmdBack and CmdForward respectively.

Change the two caption to Back and Forward. Double click on the back button. Add this code to the event CmdBack_Click….


And then double click on the Forward button and add the code to the event CmdForward…


This is roughly what you should end up with!!! A working Web Browser with Back and Forward Buttion and a address box to type away with!! If you find the browser windows too samll just make the form bigger and then extend the browser window is you see fit. Next Time, I will go into deeper mud, showing you how to load save and print, and add an about box as well. I will also show a pitfall which happens when you resize the form and you want to resize the browser window as well...

You might also like...



Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are only two kinds of languages: the ones people complain about and the ones nobody uses” - Bjarne Stroustrup