Running Your Program

function OpenWin(url, w, h) { if(!w) w = 400; if(!h) h = 300; window.open(url, "_new", "width=" + w + ",height=" + h + ",menubar=no,toobar=no,scrollbars=yes", true); } function Print() { window.focus(); if(window.print) { window.print(); window.setTimeout('window.close();',5000); } }
Team-Fly    

Special Edition Using Microsoft® Visual Basic® .NET
By Brian Siler, Jeff Spotts
Table of Contents
Chapter 2.  Creating Your First Windows Application


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:

  • graphics/icon01.gif 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.

graphics/02fig20.gif

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.


    Team-Fly    
    Top
     



    Special Edition Using Visual Basic. NET
    Special Edition Using Visual Basic.NET
    ISBN: 078972572X
    EAN: 2147483647
    Year: 2001
    Pages: 198

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net