Solved

"Type expected" on custom control

Posted on 2009-07-08
5
221 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 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