Windows forms are no longer displayed in Design file & Designer code is full of erros after VS updates.

VigAkkord 0 Reputation points
2024-09-04T03:48:33.3133333+00:00

I am using Visual Studio 2022 (64 bit) version 17.11.2 in Windows 11 version 23H2.

I have this solution/project which used to be able to be compiled and all of a sudden, the two windows forms that I have for menus that are displayed with choice no longer display and the Design file does not display the line number where the error exists.

This is due to the fact that the Designer does not recognizes the "inherits System.Windows.Forms.Form" and just says that "that" is "not defined" and everything after is therefore an error; yet this code was working as such in another version. As a matter of fact, I loaded that form into another test solution/project and the form was displayed, but to my amazement once I took out a file out of the project that had nothing to do with the form, the display of the form disappeared with the same errors under tags above. Another thing is that it makes no sense that, as I used to do before in the days of non-object-oriented programming, one could run a file which was a dll independently to test the code; now that is not possible, and everything is full of dependencies. Talking about dependencies, in this case all of them are there for the Windows Forms.

All of the suggestions I have here and followed and still the errors persist. As an example, there is one that indicates that the Designer is 32-bit and that in order to run 64-bit to change the builder to any CPU, or x86 and that didn't work either. I have come to conclusion that I must find another program that one can write code, tested it independently, and able to add and take out project files without deleting them (under VS though you load them, they're still part of the project unless you delete them from the hard drive.

This is convenient when one wants to reuse code to just copy part of a sub or function without having to rewrite them all over; furthermore, once loaded probably will cause it to not work in previous project it was used. I'm truly frustrated. I have spent countless months unable to solve this problem. When I used to write all the routines myself, that wasn't a problem, instead of trying to use all of these windows' system. Of course, may be answer is that one cannot write VB.net code in VS 2022 and will have to switch to C++ .

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,035 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 30,336 Reputation points Microsoft Vendor
    2024-09-04T06:35:20.6166667+00:00

    Hello @VigAkkord,

    Thank you for taking time to post this issue in Microsoft Q&A forum.

    Can you confirm that this issue only appears on specific project, not all projects? Do you still remember the version of VS which worked correctly before you updated it?

    If the issue only appears on specific project, maybe the issue is related to that project/code. You can try following method:

    1. Remove the hidden .vs folder(in your solution folder), bin and obj folders, then rebuild your project.
    2. If you changed some code or files, try to recover them, just for test. If the issue disappears, kindly share us the code snippet or the file that you modified, for further check.

    If the issue appears on all the projects, maybe the issue is related to Visual Studio. You can try following:

    1. Rollback VS(VS Installer > More > Rollback to previous version) as a temporarily workaround.
    2. Reset(run devenv /ResetSettings in Developer Command Prompt for VS 2022) and repair VS(VS Installer > More > Repair).

    once I took out a file out of the project that had nothing to do with the form, the display of the form disappeared with the same errors under tags above.

    What’s that file, is this reproducible on a newly created project?

    Please don’t hesitate to contact us.

    Best Regards,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.