
Cannot Debug the Windows Forms User Control or Component
If your control derives from the UserControl class, you can debug its run-time behavior with the test container. For more information, see How to: Test the Run-Time Behavior of a UserControl.
Other custom controls and components are not stand-alone projects. They must be hosted by an application such as a Windows Forms project. To debug a control or component, you must add it to a Windows Forms project.
To debug a control or component
From the Build menu, click Build Solution to build your solution.
From the File menu, choose Add, and then New Project to add a test project to your application.
In the Add New Project dialog box choose Windows Application for the type of project.
In Solution Explorer, right-click the References node for the new project. On the shortcut menu, click Add Reference to add a reference to the project containing the control or component.
Create an instance of your control or component in the test project. If your component is in the Toolbox, you can drag it to your designer surface, or you can create the instance programmatically, as shown in the following code example.
Dim Component1 As New MyNeatComponent()
MyNeatComponent Component1 = new MyNeatComponent();
You can now debug your control or component as usual.
For more information about debugging, see Debugging in Visual Studio and Walkthrough: Debugging Custom Windows Forms Controls at Design Time.