Solved

"Type expected" on custom control

Posted on 2009-07-08
5
223 Views
Last Modified: 2013-11-05
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?
0
Comment
Question by:PhotoCompManager
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 27

Expert Comment

by:VBRocks
ID: 24804844
You just have to declare it...

  Dim tt AS New MyControl()

0
 

Author Comment

by:PhotoCompManager
ID: 24804908
That's what I have ...
Private iPicImage As New cmImage
0
 
LVL 27

Expert Comment

by:VBRocks
ID: 24804939
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.

Example:
MyProject.cmImage
MyProject.Controls.cmImage
(or whatever it is).

0
 

Author Comment

by:PhotoCompManager
ID: 24805034
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)
0
 
LVL 27

Accepted Solution

by:
VBRocks earned 125 total points
ID: 24805603
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.



0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question