Tuesday, 11 September 2007

Part 5 : Adding a Title Bar

So, you've created the browser and you're a bit more familiar with how Visual Basic 2005 works. Now I'm going to show howto add a title bar to your site.
So, open Visual Basic, and open your website project.

So, from the tool bar, scroll down through the toolbox and go to Menus & Toolbars, what we're looking to add is a Menu Strip.
Drag it onto the form and you'll be greeted with an extra slot at the top of your page which allows you to create a menu like you're used to seeing in all your usual applications.
I'll add a "Close Program" command and a Back And Forward navigation to the application and leave the rest for you.

So, in your menu bar, put the tags you want in but, make sure you include "Close", "Back" and "Forward" in there somewhere.

Coding for "Close"

The Code for ending an application is really simple, and can be done by simply putting "End" in your code somewhere. Because we want the program to close when "Close" is clicked, what you do is, double click on your "Close" command tag in your Form and it will again bring you to the code of your program. Just type in End and that is all. Now, when End is clicked, the program will exit.



Going Back



Going back is coded quite similiar to Close in that, all you have to do is type one line of code in the "Back" section. So, Double Click on Back and it will take you to the code section. All you have to do is type :

WebBrowser1.GoBack()

Now, when Back is clicked, your browser will go back a page.



Going Forward



Going forward is the exact same as going backwards exact that in the ".GoBack" tab, you type ".GoForward". Now you've got a browser which can go back and forward pages like every other browser.



That's all for now, next I'll show you how to create a bar at the bottom which shows the complete URL of the page you're visiting.

1 comment:

Mr E Barr said...

EXCELLENT use of your blog so far! Very well thought out tutorial on making a web browser - just please take the full names off from links sidebar. Use initials or firstnames only. Thanks again for uploading some good stuff!