Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My custom user control is grayed out in toolbox

I have a solution that includes two projects. My main project is a windows form and the other project includes two user controls that I created. I have a test form in the second project, and there I have no problem using the user controls from the toolbox. However, in my main project I cannot use the user controls. I've found various 'solutions' online and tried them all with no success. The problem is, the controls ARE in the toolbox, they are just grayed out. I have:

  • Checked that both projects use the same .NET framework
  • Checked that autopopulate setting for the toolbox is true
  • Referenced the user control project
  • Have them both in the same solution
  • Rebuilt my project and solutions and restarted VS multiple times
  • Reset my toolbox
  • Clicked "choose items" and made sure the controls were checked

NOTE: If I create the user control programmatically, it compiles, shows up and works perfectly fine on run! I want it to show up in the designer though and not be gray in the toolbox.

like image 301
Harvey Avatar asked Oct 28 '25 01:10

Harvey


1 Answers

Make sure the control you want to add is a Public class.

like image 199
Shaun Kelsey Avatar answered Oct 29 '25 15:10

Shaun Kelsey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!