Solved

"Type expected" on custom control

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to use odbc in vb to connect to ms sql 14 52
SQL syntax in VB.net 5 39
C# Single Form 8 42
VB 2005 how to get a new line of data each time I try to write to a file. 10 24
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

816 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now