Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

User control type not defined

I'm having trouble adding user controls to my project.

  1. I right-click on my project and select Add -> User Control...
  2. I then click Add
  3. I drag a label onto the new user control, and save it.
  4. I build the project, go back to my main form, and drag the control from the Components tab in the Toolbox onto the form.

I see the control, but I get an error:

Type 'crm.UserControl1' is not defined.

If I do this with a blank project, it works. I'm not familiar enough with vb.net or visual studio to understand what's going wrong.

If I double-click the error, it brings me to this line in the generated designer code for the form:

Me.UserControl11 = New crm.UserControl1()

and says that crm.UserControl1 is not defined. If I change it to Global.crm.UserControl1, it works, but obviously this code is overwritten when I fiddle with the designer.

Any ideas, or pointers to get me started in the right direction? Thanks in advance.

like image 244
Sam Selikoff Avatar asked Jan 20 '26 01:01

Sam Selikoff


1 Answers

My main form had the same name as the root namespace. This is what caused the problem.

like image 122
Sam Selikoff Avatar answered Jan 22 '26 16:01

Sam Selikoff