Today, I’ll be showing you how to create a very simple Web Browser with basic navigation controls. Today I am going to use Visual Basic 2010, If you don’t have get a free trial of Visual Studio from here (Any version after VB6). Visual Studio is a Creative Suite from Microsoft for developing Windows Applications. Visual Studio consists of three Programming languages namely Visual Basic, Visual C++, Visual C# (C Sharp) and Visual F# (F Sharp) (Recently announced in VB 11). Visual Basic uses .Net(dot net) programming language which is the easiest and the simplest of all the other Scripting Languages. So let’s begin
1.Create a new project and give it a name, Select ‘Windows Forms Application’ and select ‘Ok’.
2.Resize the form by making it bigger and in the properties Window, Change the ‘Text’ (In earlier versions, it is labelled as ‘Caption’) to the name of your Web Browser.
3.Insert 6 Buttons and a Text box from the Toolbox. Place them above the Window, They are going to be the navigation buttons.
4.Now with the Pointer selected, Change the Text of each of the buttons from the Properties windows to Back, Forward, Go, Home, Refresh, Stop.
5.Inert a Web Browser and resize to fill almost the whole form but don’t cover the buttons and text boxes (i.e. Navigation Bar)
6.Double click on each of the buttons and add the following codes:
For Back button: Webbrowser1.Goback()
For Forward Button: Webbrowser1.Goforward()
For Go Button: Webbrowser1.Navigate(textbox1.text)
For Home Button: Webbrowser1.Gohome()
For Refresh Button: Webbrowser1.Refresh()
For Stop Button: Webbrowser1.Stop()
7.Press F5 (or) Select the ‘Play‘ button on the navbar to test your application. It should look something like this.
There’s so much you can do to your Web Browser like adding tabs, History, Search bar and lot’s more. I’ll be posting more articles so stay tuned….