Solved

Object type cannot be converted to target type.

Posted on 2004-10-12
5
1,056 Views
Last Modified: 2007-12-19
Hello

I receive 4 of the same errors in the task pane (with a form icon to the left of the below text)

Object type cannot be converted to target type.

When I double click this, the code view opens and the cursor points at the very top of the file.

Note the project compiles with 0 errors and warnings, but I would like to know how to get rid of these errors in the task pane. Where to start debugging such a problem?
0
Comment
Question by:auk_ie
  • 2
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
tinchos earned 150 total points
ID: 12292044
The problem you're having is that you're trying to cast an object to a type that cannot be casted to.

What you should do is debug your program and when you get to the part where it throws that exception
watch what is the type of the object you're casting and check if it is the same as the type you want to convert to.

Hope this helps

Tincho
0
 

Author Comment

by:auk_ie
ID: 12292792
Do you mean run the program in debug mode. I have tried that but it doesn't throw any exceptions.

If thats not what you mean, can you ellaborate.

Also I don't understand why when I click on any of the four errors, the cursor points me to the top of the file

i.e.
using System;

and not the error in question. What dous that form icon beside the error mean?
0
 
LVL 9

Expert Comment

by:tinchos
ID: 12293005
Sorry, but then, when are you receiving the errors?
when you compile it?

Tincho
0
 
LVL 10

Assisted Solution

by:Hans Langer
Hans Langer earned 100 total points
ID: 12293330
Do you use Control Version ?
Maybe the File is Read-Only
0
 

Author Comment

by:auk_ie
ID: 12293763
Yes its very strange

I think this error had something to do with crystal reports 9 that I installed after installing VS .nwt 2003 which came with v 10. But any way it's gone now after me verifying DB in the designer.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 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

15 Experts available now in Live!

Get 1:1 Help Now