Objectives:

  • Create Your Own Web Browser This project is adapted from a book entitled VB6 for Web Development by Rod Paddock

Create Your Own Web Browser



Did you know you can use Visual Basic to make your own web browser from scratch? To do this project, you will need to add some components to your Visual Basic toolbox. If you are doing this from home, start with step 1. If you are in my lab, you will most likely get an error message when you try to change the toolbox. If so, call me over.

  1. Add a new form to your master project and make sure you can see the toolbox.

  2. Change the name property to frmBrowser.

  3. Right click on the tool box and select components.

  4. Scroll till you see the checkbox for "Microsoft Internet Controls". Click on it.

  5. Scroll till you see the checkbox for "Microsoft Windows Common Controls 6.0". Click on it.

  6. Add a Web Browser from the toolbox onto your form by double-clicking it.

  7. Change the Window State property of your form to Maximized.

  8. Resize the browser to fill most of the form space.

  9. Add a command button to your form. Change the caption to Go!

  10. Add a text box to your form. Change the name property to txtUrl.

    Note: Do you know what URL means? It stands for Uniform Resource Locator. It's the same as the name of a web address.

  11. Double click the commmand button on your form and type WebBrowser1.Navigate(txtUrl).

  12. Run your program, type in a URL and hit the go button. You should see the website appear in your browser.

    Instead of typing txtUrl inside the parantheses of the navigate function, you can also type the exact name of a website in quotes as in:

    WebBrowser1.Navigate ("http://www.yahoo.com")

    If you click on the button, it will open the browser directly to Yahoo.

    It's easy to add navigational capabilities to your browser. For example, the code to make a back button is:

    WebBrowser1.GoBack

    To go forward:
    WebBrowser1.GoForward

    To Stop:
    WebBrowser1.Stop

    And to search:
    WebBrowser1.GoSearch

    You can place your code inside the button on a web toolbar, inside a regular command button, even inside a drop down menu.

Assignment

  • Modify your browser form's color and look to your liking.

  • Create a vertical drop-down menu that allows the user to go back, to forward, stop, and search.

  • Add a toolbar with five buttons that link to five of your favorite sites.


    Link your new browser to your master project.

    << Back to Skyline