This Season
 

How to Create a Web Browser using VB

The best way to learn Visual Basic, or any other programming language for that matter, is to dive in and create an application. Books and online tutorials are good resources, but nothing beats actually getting started with your own app. One of the easiest applications to create in Visual Basic is a simple Web browser. While creating a complex, full-featured browser, such as Internet Explorer or Firefox, takes a great deal of work, creating a simple browser in Visual Basic is an excellent way to learn how to create forms and buttons in the programming environment as well as to learn how to write code to perform simple navigation procedures.

Related Searches:
    Difficulty:
    Moderately Easy

    Instructions

    Things You'll Need

    • Visual Basic, Visual Basic Express or Visual Basic Studio
      • 1

        Launch Visual Basic on your computer. Create "File," then "New Project." In the New Project window, select "Windows Forms Application." Enter "My Web Browser" or something similar in the name field and click "OK." Visual Basic displays the Form Designer with a blank "Form1" window.

      • 2

        Click the "Toolbox" tab to open it. If your Toolbox tab is not visible, click "View," then "Toolbox." Click the "All Windows Forms" tab in the Toolbox.

      • 3

        Scroll-down to and highlight the "Panel" control. Drag the Panel control to the upper right-hand corner of the "Form1" window. Select the "Textbox" control in the Toolbox tab; drag it on to the Panel control.

      • 4

        Drag a "Button" control on to the Panel control. Use the mouse to move the Button control to the right of the Textbox control.

      • 5

        Select the "WebBrowser" control in the Toolbox tab and drag it to the Form1 window beneath the Textbox and Button controls. Use your mouse to resize the Form1 window and make it larger so you can work with the controls on the form easily.

      • 6

        Highlight the "Panel" control. With the Panel control highlighted, scroll to the "Dock" value in the Properties pane. Set the Dock property to "Top." The Panel control expands to fill the top portion of the Form1 window.

      • 7

        Click and select the "WebBrowser" control. Set the Dock property for the WebBrowser control to "Fill." The WebBrowser control expands to fill the lower part of the Form1 window beneath the Panel control.

      • 8

        Use your mouse to resize the TextBox control until its length is appropriate for a browser Address Bar. Resize the Button control. With the Button control selected, change the "Text" property for the control to "Go."

      • 9

        Double-click the "Go" Button control. The Code Editor window opens. Enter the following code in the space between the "Private Sub" and "End Sub" lines in the code editor:

        WebBrowser1.Navigate(TextBox1.Text)

      • 10

        Click "Debug" on the menu bar, and then select "Start Debugging." Visual Basic launches Form1 as a live application window. Enter a URL address in the Textbox control and click the "Go" button. The Form1 browser window opens the page of the URL address you entered.

    Tips & Warnings

    • You can additional buttons to the Panel control to expand navigation functionality of the browser. You simply need to change "Navigation" action command for the button. To create a "Home" button -- that navigates to the Home page in your default Web browser -- use the "WebBrowser1.GoHome()" command. For a "Forward" button, enter "WebBrowser1.GoForward()" in the Code Editor. A "Back" button would use the command "WebBrowser1.GoBack()" command.

    • A commercial browser has a lot more functionality built into it such as History, Favorites, Tabs, and more. Spend a little time on it and you'll be amazed at what you can accomplish.

    Related Searches

    References

    Read Next:

    Comments

    • santoshraj007 Sep 11, 2008
      It's a nice program for New Developer. Santosh Raj, Ratlam

    You May Also Like

    Follow eHow

    Related Ads