Solved

"Type expected" on custom control

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Encryption Decryption in Oracle 12 108
No row return after calling the fillschema method 4 40
Populating an array of locale_time_info 8 37
Vb.net dynamic formulas in runtime 11 63
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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

863 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

20 Experts available now in Live!

Get 1:1 Help Now