This documentation is archived and is not being maintained.

Step 5: Run and Test Your Program

Now that your program is complete, it is time to run and test it. For complex programs, testing can be a long and difficult process, which will be discussed in detail in a later lesson. Happily, for this program, all you need to do is run it!

video For a video demonstration, see Video: Creating Your First Visual Basic Program.

To run your program

  1. Connect your computer to the Internet.

  2. On the Debug menu of the Visual Basic IDE, click Start Debugging.

    This command runs your program.


    A shortcut to run your program is to press F5.

  3. In the text box, type and click the Go! button.

    The WebBrowser control in your program navigates to the Microsoft home page. From there, you can navigate through any related links. To visit another Web page, type the address in the text box and click the Go! Button.

  4. To close the program, on the Debug menu, click Stop Debugging.


    You can also end the program by clicking the Close button on the top-right corner of the form.

In this lesson you ran your program to see if it worked. For most Visual Basic programs, you will repeat this process many times. Typically after adding some new code, you will run the program to see if the code does what you expected it to do—if it doesn't, you will need to fix it. This process is called debugging; it will be discussed in detail in a later lesson.

It may seem like magic that your program navigates to a Web page and displays it, all as a result of you writing a single line of code. This is the beauty of Visual Basic—all the necessary code is built into the WebBrowser control, saving you time and effort. If you had to do it all yourself, it would take hundreds or even thousands of lines of code!


If your program does not run or display the Web page, there are a few things you can check:

  • Make sure you are connected to the Internet. Open Internet Explorer and try to navigate to the Microsoft home page. If it works in Internet Explorer, it should also work in your program.

  • Make sure that you typed the address ( correctly.

  • Go back and check Step 2: Create a User Interface and make sure that you put the correct controls on the form.

  • Go back to Step 4: Add Visual Basic Code and make sure that you typed the code correctly.

Next Steps

Congratulations! Your first Visual Basic program is complete. You have demonstrated how powerful programs can be developed quickly and easily by using Visual Basic. In the following lessons, you will be introduced to more features of the Visual Basic programming language.

Next Lesson: Introduction to the Visual Basic Programming Language