Running Your Program

I’ll bet you’re anxious to see your program in action! Before running it, however, make sure you save your work so far. To run the program, you need to execute Visual Basic’s Start command using any of these methods:

  • Click the Start button on the Visual Basic toolbar.

  • Choose Debug, Start from the menu system.

  • Press F5.

When you execute the Start command, Visual Basic compiles your program to check for certain types of errors; if your Output window is visible, you will see the results as it builds the application. If no errors are found, the program will begin executing and you’ll see your user interface. Notice in Visual Basic’s title bar that you’ve gone from Design mode to Run mode, meaning that the program is actually running. Because the application is object-oriented and event-driven, it’s waiting for you (the user) to cause an event to occur to an object, such as typing in a text box or clicking a button.

Test your program by entering values for the principal, term, and interest rate. Use these values for your first test:

Principal 128000
Interest Rate 9.75
Term 30

After entering these values, click the Calculate Payment button. The monthly payment displayed should be $1,099.72 (see Figure 2.20).

Figure 2.20. The Loan Calculator program is now fully functional and can calculate loan payments.


Note

Because this program is a demonstration of basic programming techniques, its interface is quite simple, and very little effort has gone into making it error-proof. Numbers must be typed without thousands separators or dollar signs for the calculations to work properly. As you develop your programming skills later in the book, you’ll see how to overcome these types of limitations.


Test the program with other combinations of numbers. When you’re through, end the program by clicking your application’s Exit button. This will return you to the design environment.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.31.206