3

I have created the custom control which is just a panel that I will be using to render my DirectX code. However, I am unable to see the control in my toolbox for when I try to add it into the designer. I right clicked on my project then clicked on add new item. From there I clicked on custom control, renamed it to CustomPanel, and placed my code in it. I tried everything from restarting VS to deleting and creating a new custom control. Is there anything that I am missing? This is being done in Visual Studio 2005.

2
  • 1
    Did you build your project? It won't show up untill it's built successfully.
    – veljkoz
    Commented Sep 2, 2010 at 14:39
  • I built the project a few times. I ran a clean and rebuild as well as just plain builds. Still unable to get anything.
    – Seb
    Commented Sep 2, 2010 at 14:44

5 Answers 5

9

Right click the Toolbox, then Choose items and browse for the .dll file that contains your control. The Toolbox will add all the components found in that dll. Also check in Tools -> Options -> Windows Forms Designer if the AutoToolboxPopulate setting is set to true.

1
  • +1 for the AutoToolboxPopulate setting, that sounds like the problem here. Commented Sep 2, 2010 at 14:55
0

Is the control class public ? The default template creates an internal class.

Is there a public parameterless constructor ? The designer needs it.

1
  • The control is a public partial class with a CustomPanel constructor that is public as well.
    – Seb
    Commented Sep 2, 2010 at 14:49
0

Did you right click on the toolbox and click "Choose Items", and then browse to the built assembly that contains your custom control?

That's what I always have to do, and then my custom controls show up in the "General" section of the toolbox.

2
  • I cannot seem to find the assembly linking the control itself. I added the control into the project itself. I never made a separate project just for the control as I know that it isn't necessary.
    – Seb
    Commented Sep 2, 2010 at 14:56
  • Try the AutoToolboxPopulate setting mentioned in devnull's answer, that sounds like what you want here. Commented Sep 2, 2010 at 14:59
0

C# custom control will automatically populate once you build the project in which it is created & add reference of that project to the project having Form which needs that custom control. Faced the same problem myself. Once dll is made for that project and included using add references in the project you want its use, It is sure to see it in Toolbox.

-1

and check that you mustn't stay in the custom control's designer window.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.