How to add a UserControl which is in a Folder in Project to ToolBox
Asked Answered
N

2

2

I'm working on a Windows Forms project in Visual Studio 2012.

In the solution of the project, I created a new Folder named userControls and added to it a user-control (UserControl1).

Here is the tree view of the solution:

enter image description here

How can I access the UserControl in that folder from the ToolBox?

Rebuilding the Solution and restarting Visual Studio didn't solve my problem.

Newmann answered 4/10, 2016 at 11:14 Comment(3)
Try this: After closing Visual Studio, delete bin and obj folder. Also go to %userprofile%\appdata\local\Microsoft\VisualStudio\11.0\ProjectAssemblies and delete all folders.Constriction
@RezaAghaei That works, Thank you!Newmann
@RezaAghaei btw, you can add it as answer, and i'll accept it.Newmann
C
2

User controls which are in the current project will be added to toolbox automatically after a successful build and you don't need to perform additional tasks to do so.

Such problems which the toolbox not being populated with new user controls, are usually build error or designer errors. To solve the problem you can perform these tasks:

  • Close Visual studio
  • Delete Visual Studio designer cached files. To do so, go to below path and delete all folders:

    %userprofile%\appdata\local\Microsoft\VisualStudio\11.0\Proj‌​ectAssemblies 
    
  • Delete bin and obj folder of your projects.

  • Open Visual Studio again and build solution.
Constriction answered 8/10, 2016 at 11:22 Comment(0)
L
0

1.You can add this to you Toolbox using

Toolbox -> right click -> Choose Items -> Browse

Select your assembly with the UserControl.

2.Build the entire solution. After that, your UserControl should appear in the toolbox.

Leeann answered 4/10, 2016 at 11:35 Comment(2)
its VS2012, right-clicking on ToolBox doesn't have this option, rather it gives me those: Dock, Float, Auto Hide, Hide, Docked as Tabbed DocumentNewmann
@mww Controls which are in the current project will be added to toolbox automatically. Usually such problems are build/designer errors.Constriction

© 2022 - 2024 — McMap. All rights reserved.