On the Microsoft forums I saw the question:
Can someone suggest me how shuld I use .NET controls in Windows Forms projects?
In fact, I would Use this custom controls like “normal” customControls…
Windows forms can use a couple different types of controls: Legacy COM based Object Linking and Embedding controls (OCX), Managed Windows Forms Controls and Windows Presentation Foundation Controls.
In your query you refer to “.NET” versus “Normal” controls for Windows forms. Since i am not certain which you are referring to i will walk through creating and using them both in Visual Studio 2008 (if my screen shots look like a little different it is due to the fact i am running a pre release version of Visual Studio 2008)
Step 1: Create the host application
The easiest way to get started with custom controls in Visual Studio is to start with a Windows Forms Application to host the user controls.
This is done via File > New Project > Windows Forms Applications (see image below)
Step 2: Add Custom Controls
As mentioned earlier I am not certain wheter you are refering to WPF or Windows Forms controls- luckily in Visual Studio 2008 the process is the same regardless of which type of control you are creating. To add your custom controls you must first save the host project or you will get the error:
The current project must be saved before adding a new project.
The next step is to go File> Add Project Windows Forms Control Library
And File> Add Project > WPF User Control Library
In the solution explorer This should then look like the following:
(note the default Windows forms Control and WPF User Control names)
One you have saved and built the solution these controls will be available on your toolbox (see image)
Dragging these controls onto your Windows form will look a little like the following image. (I have added a button on the Windows Forms control)
viola you are done!
To use these controls from any other Windows form project simply right click on the toolbox, select “Choose items” and browse to the control assemblies built in the previous sections.
For more information on WPF Controls in Windows Froms see: