Results 1 to 10 of 10

Thread: Object type cannot be converted to target type.

  1. #1

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Object type cannot be converted to target type.

    I used VS 2003 for a while before but I never had a copy to run on my home copy. Edneeis was nice enough to send me an evaluation copy of VS 2002. For some reason, 1 of my C# projects compiles fine, however, the task list gets filled up with " Object type cannot be converted to target type." about 20 different instances of it, all pointing to line 0, which is just
    Code:
    using System;
    It still will compile, but it is annoying to have all of those in my task list, especially since I don't understand why they're there anyway.

    So, um, is there a way to turn off that warning or something? It's annoying.

  2. #2
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    try removing all your refreances and readding them to clear a version conflict... other then that you got me....
    Magiaus

    If I helped give me some points.

  3. #3

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Didn't do anything. Also, I can combine the project fine but the forms I made to be used as a dialog box don't work as a dialog box, and if I try to open any of them in design view, all properties on the form and objects become lost.

    I guess I'm gonna have to wait until I get VS 2003 to do this, I don't feel like re-doing all those forms.

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    VS.NET2002 is just f-ucking buggy .

  5. #5
    Member
    Join Date
    Oct 2002
    Location
    Look out your window.
    Posts
    54
    Originally posted by Pirate
    VS.NET2002 is just f-ucking buggy .
    I just started writing C# in it, but I haven't had a problems with it (except for minor bug in the XML Designer, but it still wasn't doing anything wrong).

    Originally posted by kasracer especially since I don't understand why they're there anyway.
    Its so you don't have to qualify the namespace the object is in. Like in C++. I don't think they are required.

    Originally posted by kasracer if I try to open any of them in design view, all properties on the form and objects become lost.
    I think you need to define a "region" within the source file that the Designer can write stuff to. Then your existing code wouldn't get overridden. I think. I just remember starting up a default Windows Application project and seeing #region/#endregion compiler directives.

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by amac
    I just started writing C# in it, but I haven't had a problems with it (except for minor bug in the XML Designer, but it still wasn't doing anything wrong).
    I just started
    After sometime , you'll realize how buggy it's .




    I think you need to define a "region" within the source file that the Designer can write stuff to. Then your existing code wouldn't get overridden. I think. I just remember starting up a default Windows Application project and seeing #region/#endregion compiler directives.
    #code region directives are only for code management in the MS IDE . It has nothing to do with code compilation or anything .

  7. #7
    Member
    Join Date
    Oct 2002
    Location
    Look out your window.
    Posts
    54
    After sometime , you'll realize how buggy it's .
    I just started using it for C#. I've used it for a while for doing C++ development.

    #code region directives are only for code management in the MS IDE . It has nothing to do with code compilation or anything .
    Sorry... used the wrong term. Not a compiler directive... still a directive... of some sort. Either way, what I was referring to may solve kasracer's problem.

  8. #8
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    if vs.net is going to put it's code in a region it creates the region and the code. You may be right about a region protecting his code but I wouldn't bet on it.

    I think maybe making a complete new project and moving the existing code in, in stages through the clipboard would be the best way to find and eliminate the problem. I can remember in vb6 at times the @#$&ing thing would just decide not to work anymore and even though the code was correct you would have to recreate the entire project and paste in your code from the old project used to tick me off.
    Magiaus

    If I helped give me some points.

  9. #9
    Member
    Join Date
    Oct 2002
    Location
    Look out your window.
    Posts
    54
    Yah, I'm not sure. It was just a thought.

    Is it possible to have one source file with code generated from the Form designer and have your custom code in a different source file? Maybe eliminating the possibility for it to overwrite your code.

  10. #10
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    as far as I know the only sure way to keep vs.net from touching your code is to not use it and keep your code out of the regions it uses
    Magiaus

    If I helped give me some points.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width