Testing and Debugging a Windows Forms Application - How to run a project
(Page 3 of 6 )
As you learned in chapter 1, you can
run a project by clicking the Start Debugging button in the Standard toolbar, selecting the Start Debugging command from the Debug menu, or pressing the F5 key. This
builds the project if it hasn’t been built already and causes the project’s form to be displayed, as shown in figure 3-13. When you close this form, the application ends. Then, you’re returned to Visual Studio where you can continue working on your program.
You can also build a project without running it as described in this figure. In most cases, though, you’ll run the project so you can test and debug it.
If build errors are detected when you run a project, the errors are displayed in the Error List window, and you can use this window to identify and correct the errors. If it isn’t already displayed, you can display this window by clicking on the Error List tab that’s usually displayed at the bottom of the window. When you do that, you should realize that the errors will still be listed in the Error List window and highlighted in the Code Editor even after you’ve corrected them. The errors aren’t cleared until you build the project again.
The form that’s displayed when you run the Invoice Total project

Figure 3-13. How to run a project
Description
- To run a project, click the Start Debugging button in the Standard toolbar, select the Debug->Start Debugging menu command, or press the F5 key. This causes Visual Studio to build the project and create an assembly. Then, assuming that there are no build errors, the assembly is run so the project’s form is displayed as shown above.
- If syntax errors are detected when a project is built, they’re listed in the Error List window and the project does not run.
- To locate the statement that contains the error, you can double-click on the error description in the Error List window. After you’ve corrected all the errors, run the project again to rebuild it and clear the errors.
- You can build a project without running it by selecting the Build->Build Solution command.
- When you build a project for the first time, all of the components of the project are built. After that, only the components that have changed are rebuilt. To rebuild all components whether or not they’ve changed, use the Build->Rebuild Solution command.
Next: How to test a project >>
More C# Articles
More By Murach Publishing
|
This article is excerpted from chapter three of the book Murach's C# 2005, written by Joel Murach (Murach, 2005; ISBN: 9781890774370). Check it out today at your favorite bookstore. Buy this book now.
|
|