Debugging Preparation: Windows Forms Applications
The Windows Forms project template creates a Windows Forms application. Debugging this type of application in Visual Studio is straightforward. For more information, see How to: Create a New Windows Forms 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 |
|
You can debug Windows Forms applications from inside Visual Studio, or by attaching to an already running application. For more information about attaching, see Attach to Running Processes with the Visual Studio Debugger.
To debug a C#, F#, or Visual Basic Windows Forms application
Open the project in Visual Studio.
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:
Events associated with a control, such as Click, Enter, etc.
Events associated with application startup and shutdown, such as Load, Activated, etc.
Focus and Validation Events.
For more information, see Creating Event Handlers in Windows Forms.
On the Debug menu, click Start.
Debug using the techniques discussed in Debugger Roadmap.
See Also
Tasks
How to: Set Debug and Release Configurations
Concepts
Project Settings for C# Debug Configurations
Project Settings for a Visual Basic Debug Configuration
Other Resources
Debugging Preparation: C#, F#, and Visual Basic Project Types