Solved

Object type cannot be converted to target type.

Posted on 2004-10-12
5
1,065 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

803 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