i’ve written a UserControl descendant that is in an assembly dll.
How do i drop the control on a form?
namespace StackOverflowExample { public partial class MonthViewCalendar : UserControl { ... } }
i’ve added a reference to the assembly under the References node in the Solution Explorer, but no new control has appeared in my Toolbox.
How do i make the control appear in the Toolbox so i can drop it on a form?
Update 1:
i tried building the assembly while the Visual Studio option:
Tools–>Options…–>Windows Forms Designer–>AutoToolboxPopulate = true
The control didn’t appear when in the toolbox in a new solution.
Note: i somehow mistakenly wrote ‘…that is not in an assembly dll…’. i don’t know how i managed to write that, when it specifically is in an assembly dll. Controls have magically appeared when they’re in the same project, but not now that it’s a different project/solution.
Update 2: Answer
- Right-click the Toolbox
- Select Choose Items…
- .NET Framework Components tab
- Select Browse…
-
Browse to the assembly dll file that contains the control and select Open
Note: Controls in the assembly will silently be added to the list of .NET Framework Components.
- Check each of the controls you wish to appear in the toolbox
- Select OK
Normally, when you build your project, your user control will appear in your toolbox at the top. Normally, you will see a new pane with each of your Assemblies and the controls in there.
If that doesn’t happen, you can also add your control by right clicking on the toolbox, selecting Choose Items, then under .NET Framework Components browsing for your assembly, adding it, then make sure your control is checked.