Running a Visual Basic .NET Program


There are two ways to run a Visual Basic .NET program while you are in the IDE. The first way is to click the Start button (the right-pointing triangle to the right of the Debug text box).

If you click the Start button, there is a delay as Visual Basic .NET does some behind-the-scenes work, but eventually you should see a display screen similar to that shown in Figure 2.17.

Figure 2.17. The My First Program program.

graphics/02fig17.jpg

Your program is now running, even though you haven't really written any code! All the code that was needed to actually run the program was written behind the scenes by Visual Basic .NET.

The first thing you should notice is that all those dots that you saw while you were designing your program are gone. Actually, those dots were never part of the program in the first place. Visual Basic .NET simply puts them on the form to make aligning the various objects on the form a little bit easier.

The second thing you should notice is that nothing happens if you click either of the Button objects on the form. Indeed, you have to click the close box to terminate the program. This seems a bit crude, and you will learn how to fix this problem in the next section.

Recall that there are two ways to run a program in the IDE. The second way is to simply press the F5 key. This method executes the program in Debug mode, which is a little bit different from simply clicking the Start button as you did before. You will learn a lot more about Debug mode in later chapters. For now, you can just use the Start button to run your programs.



Visual Basic .NET. Primer Plus
Visual Basic .NET Primer Plus
ISBN: 0672324857
EAN: 2147483647
Year: 2003
Pages: 238
Authors: Jack Purdum

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