1.6. Run and Debug the Application

With the code you have added in the last section, it is now time to test the application. This is a good chance for you to see some of the new enhancements in the new Visual Studio 2005 debugger. For this example, you will set a breakpoint so that you can examine the values of variables at a particular point in the code.

  1. Now set a breakpoint in the application by clicking on the gray bar on the left of the code edit window (see Figure 1-24) and then running the application by pressing F5. You will set the breakpoint so that the program halts when you click on the Close box, allowing you to examine the value of DialogResult returned by the Exit dialog box (Dialog1).

    Figure 1-24. Setting a breakpoint

  2. When the form is loaded, close the form to display the dialog box. Click OK, and the application will stop at the breakpoint you have set. To step through the code one line at a time, press F11 (see Figure 1-25).

    Figure 1-25. Stepping through the code

    Edit and Continue

    Yes! The edit-and-continue feature that VB 6 programmers have always taken for granted is supported in VB 2005. Using the edit-and-continue feature, programmers can set breakpoints using the debugger in Visual Studio and then make changes on the fly (you can even roll back execution steps). After the changes are made, the application can continue executing without the need to stop entirely and recompile.

Visual Basic 2005 Jumpstart 2005
Visual Basic 2005 Jumpstart
ISBN: 059610071X
EAN: 2147483647
Year: 2005
Pages: 86
Authors: Wei-Meng Lee

Similar book on Amazon

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