"Type expected" on custom control

I've added a custom control to my toolbox and I can drag it onto a form OK. However, when I try and create an instance dynamically (etc dim tt= new mycontrol) I get a "Type expected" error. Do I need to register the control in some way?
Who is Participating?
VBRocksConnect With a Mentor Commented:
Oh, that's exactly what I meant.  "MyProject.Controls" probably wouldn't work for you.  I meant:

"MyProject" = The name of your project (like "Project1"), or the name of the dll (cmImage)
"Controls" = The namespace that your cmImage control is in, if there is one.

You just have to declare it...

  Dim tt AS New MyControl()

PhotoCompManagerAuthor Commented:
That's what I have ...
Private iPicImage As New cmImage
And you're getting that error?  

When you declare it, does it show up in intellisense?

You may try fully declaring it using the fully qualified namespace.

(or whatever it is).

PhotoCompManagerAuthor Commented:
It shows up in intellisense but MyProject.Controls.cmImage gives "not defined" ("MyProject" does not show in intellisense)

Found it - I have to type    Private iPicImage As New cmImage.cmImage

(I must have something wrong in the complilation of the DLL)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.