Question Nonsense error at runtime

ProtoNoob

New member
Joined
Jul 28, 2011
Messages
1
Programming Experience
1-3
Hello all, this is my first post here so if I do not follow all protocols just let me know and I will try to conform in the future.

Here is my problem:


I just converted my project over to 2010 from 2008. Everything seemed to be working fine (no errors came up). I ran the program and found no run time errors either. I then proceeded to update my program by adding user controls. These controls where already used by the program (through references), but were originally external. Due to issues with them not updating updating (no matter what I tried) I decided to build them directly into the project. This did not cause any issues at first, the program continued to run without errors or execptions. I replaced some of the old controls that referenced the external project with the new internal ones. The old ones were completely deleted first, and then the new ones (named same as the old ones to reduce programming errors...and yes I am sure the names are spelled EXACTLY the same) were added.

Now, the progam is throwing an exception during the variable declaration of a form I had been using with no errors: "Unable to cast object of type 'OldControl' to type 'NewControl'". I have run into cast exceptions before an am fairly good at solving whatever the problem is (usually a simple issue). Here is the kicker (actually 2 kickers)... First, NO LINES OF CODE HAVE BEEN CHANGED from when the program was working fine. I have basically changed out 'old_textbox' for 'new_textbox' in the graphical interface (and have given the new ones the old one's names) and made sure no errors came up (which didn't happen). Second, this exception is being raised on a line that has NOTHING to do with the old or new control:


Public AllowCopiesMode as Boolean = False

I know that sharing code is usually helpful in situations like these, but I wouldn't know where to begin concidering where the execption is being thrown. If anyone knows if there is an issue with vb.net 2010 or a 'quirk' that rquires me the do something slightly different, please let me know. Out side of that I am completely lost.

Thank you for any help you can give,
Scott
 
Have you removed all the references to the assemblies that contained the original controls? My guess would be that you have a reference left over and you are using the old class in one place in your code and the new in another. If that is true then you may get a different error when you remove the reference. You can locate that error and simply change the old control name to the new control name. Note that I'm talking about the fully qualified name here, which will include the namespace(s) as well.
 

Latest posts

Back
Top