Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Object type cannot be converted to target type.

Posted on 2004-10-12
5
Medium Priority
?
1,128 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 450 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 300 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Integration Management Part 2
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month7 days, 6 hours left to enroll

824 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