Results 1 to 6 of 6

Thread: Visual Studio Giving me errors when I have a duplicate Form

  1. #1

    Thread Starter
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,168

    Visual Studio Giving me errors when I have a duplicate Form

    I am trying to self-resolve an issue, I figured out myself, the problem is I need to use all the same code. However, doing so, creates an outstanding number of errors, and causes the whole project to glitch. Why is this doing this? Is this connected to the framework version?

    I have done this in other instances and it does not do this.
    Disclaimer: When code is given for example - it is merely a example.




    Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

  2. #2
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,902

    Re: Visual Studio Giving me errors when I have a duplicate Form

    That's a pretty broad question and you're probably going to have to provide more info. E.g. What are the errors you're seeing?

    Assuming you've just taken a copy of the form a few things spring to mind:-
    1. Are you using the same settings for Option strict, Option Explicit etc? If you've moved to a stricter set up you'd see a bunch of errors. Those errors are a good thing and worth fixing.
    2. Are all you're references correct? If you were referencing something in the original location that isn't being referenced by the copy you'd get loads of errors that way.
    3. Have you moved to an older framework? Backward compatibility is generally fine but forward compatibility… not so much.

    Other than that: more info needed, I'm afraid...
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  3. #3

    Thread Starter
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,168

    Re: Visual Studio Giving me errors when I have a duplicate Form

    Quote Originally Posted by FunkyDexter View Post
    That's a pretty broad question and you're probably going to have to provide more info. E.g. What are the errors you're seeing?

    Assuming you've just taken a copy of the form a few things spring to mind:-
    1. Are you using the same settings for Option strict, Option Explicit etc? If you've moved to a stricter set up you'd see a bunch of errors. Those errors are a good thing and worth fixing.
    2. Are all you're references correct? If you were referencing something in the original location that isn't being referenced by the copy you'd get loads of errors that way.
    3. Have you moved to an older framework? Backward compatibility is generally fine but forward compatibility… not so much.

    Other than that: more info needed, I'm afraid...
    Let me explain more, I agree didn't explain very good.

    So one of the functions, it adds a tab at the form loading, is causing issues with dragging events I wanted to keep the form aspect in tact when dragging vs. Creating a "new form" with just the tab control.

    Because the code side is 800 lines of Code I didn't want to have to copy each piece of code etc.

    so I used the copy/paste function for the form itself, it was named "LightBrowse Main - Copy" -


    It showed 600+ errors - if I tried some common corrections - it would cause the second form (the copy) to have a catastrophic Failure and design side be corrupted resulting another 200+ errors.

    I think its something to do with "duplicate code" I honestly am confused.
    Disclaimer: When code is given for example - it is merely a example.




    Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: Visual Studio Giving me errors when I have a duplicate Form

    It sounds to me as if you have a copy of the form in the same project, with different file names... but importantly they have the same class/Form name.

    If you change the class/form name in one (and make sure it changes in the designer file too) then most/all the errors are likely to disappear.

  5. #5

    Thread Starter
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,168

    Re: Visual Studio Giving me errors when I have a duplicate Form

    Quote Originally Posted by si_the_geek View Post
    It sounds to me as if you have a copy of the form in the same project, with different file names... but importantly they have the same class/Form name.

    If you change the class/form name in one (and make sure it changes in the designer file too) then most/all the errors are likely to disappear.
    I tried that, and all it did was create the 200+ additional errors... It just doesn't make any sense to me.
    Disclaimer: When code is given for example - it is merely a example.




    Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

  6. #6

    Thread Starter
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,168

    Re: Visual Studio Giving me errors when I have a duplicate Form

    I will re-engineer my code to disable/enable the load up events, and maybe I can avoid this way entirely (still doesn't resolve the issue itself but resolves the headache)
    Disclaimer: When code is given for example - it is merely a example.




    Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

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