adding user control to toolbox using class Library RRS feed

  • Question

  • I have made those steps:

    1. Create a new Class Library project.

    2. Delete Class1.cs, initially provided with the application.

    3. Right click the project in the Solution Explorer and select Add > User Control….
    In the dialog that appears, name the user-control file and click Add.

    4. Inside the project, add controls and functionality to the UserControl ( here I added 2 radiobuttons(Bold, Italic) and

    a label to change its text using radiobuttons)

    5. Build the project. Visual Studio creates a .dll file for the UserControl in the
    output directory (bin/Debug). 

    6. Create a new Windows application.

    7. In the new Windows application, right click the ToolBox and select Choose
    Items…. In the Choose Toolbox Items dialog that appears, click Browse…. Browse
    for the .dll file from the class library created in Steps 1–5. The item will then
    appear in the Choose Toolbox Items dialog. If it is not already
    checked, check this item. Click OK to add the item to the Toolbox. This control
    can now be added to the Form as if it were any other control.


    when doing the 7th step I got an error

    "There are no components in "C:\Users\.............\MyDLL.dll that can be placed on the toolbox"

    what is the reason? please help...

    • Moved by CoolDadTx Friday, October 11, 2013 4:59 PM Winforms related
    Friday, October 11, 2013 3:50 PM


  • If you create the new WinForms app in the same solution as your UC project then you don't need to modify the Toolbox as it'll scan all loaded projects in the solution and pick off your control. 

    If you're getting an error when trying to add your assembly then it is not properly marked for adding to the toolbox.  Verify the type is public and that the project builds.  Also verify that the version of the framework you're targeting matches the framework of the library.

    Michael Taylor

    Friday, October 11, 2013 4:59 PM