Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Debugging Preparation: Windows Forms Applications

This topic applies to:

Edition

Visual Basic

C#

C++

Web Developer

Express

Topic appliesTopic appliesTopic appliesTopic does not apply

Standard

Topic applies

Topic applies

Topic applies

Topic does not apply

Pro and Team

Topic applies

Topic applies

Topic applies

Topic does not apply

Table legend:

Topic applies

Applies

Topic does not apply

Does not apply

Topic applies but command hidden by default

Command or commands hidden by default.

The Windows Forms project template creates a Windows Forms application the common language runtime (CLR). Debugging this type of application in Visual Studio is straightforward. For more information, see How to: Create a Windows Application Project.

When you create a Windows Forms project with the project template, Visual Studio automatically creates required settings for the Debug and Release configurations. If necessary, you can change these settings. These settings can be changed in the <project name> Property Pages dialog box (My Project in Visual Basic).

For more information, see Managed Debugging: Recommended Property Settings.

The following table displays one additional recommended property setting.

Configuration Properties in Debug tab

Property Name

Setting

Start Action

  • Set to Start project, most of the time. Set to Start external program if you want to start another executable when you start debugging (usually for debugging DLLs).

You can debug Windows Forms applications from inside Visual Studio, or by attaching to an already running application. For more information about attaching, see Attaching to Running Processes.

To debug a C#, J#, or Visual Basic Windows Forms application

  1. Open the project in Visual Studio.

  2. Create breakpoints as needed.

    Because Windows Forms applications are event-driven, your breakpoints will go into event handler code, or into methods called by event handler code. Typical events in which to place breakpoints include:

    1. Events associated with a control, such as Click, Enter, etc.

    2. Events associated with application startup and shutdown such as Load, Activated, etc.

    3. Focus and Validation Events

    For more information, see Creating Event Handlers in Windows Forms.

  3. On the Debug menu, click Start.

  4. Debug using the techniques discussed in Debugger Roadmap.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft