Windows form has disappeared in Visual Studio form designer

16,787

Solution 1

I had similar issues in VS2019. I resolved it by using:

Window > Reset Window Layout.

Then double clicked on the Form in the Solution Explorer.

Prior to this, double clicking the form was having no effect.

Solution 2

Weird, after trying for an hour I ended up solving the issue 30 seconds after posting this!

I edited the size property of an item on the form using the properties tab, saved the form, and then reverted the form.cs, form.designer.cs, and form.resx files to the latest source control version.

At this point the form jollily re-appeared.

Edit: FWIW, this didn't work with another form which was exhibiting the same problem.

Edit 2: That other form has now fixed itself after coming back from lunch and unlocking my PC... Might be something to do with how that affects the display - everything shifts over to my right hand monitor when I do that.

Edit 3: OK, now it seems that modifying my display DPI fixes it. On Windows 10 go to System Settings -> Display, and then move the "Change the size of text: 100%" option to say 200%. Once this changes on screen, move it back to 100%.

This seems quite foolproof, although you sometimes have to jimmy it around a lot before it finally works. I know it has worked when I get both a vertical and horizontal scrollbar; the form is then further down the page.

Solution 3

Just go to Form1.cs (Form1 is the name of your form), if you are able to see your source code then press Shift + F7. The form will show up.

Solution 4

I also had a similar issue in VS2019.

My form [Design] was listed in the solution explorer but the code was not listed as a sub-item of that form.

I could access the code by right-clicking on the form in the solution explorer and choosing view code.

What seemed to solve the problem was to close down VS2019 and simply re-open it up.

Solution 5

A Message appeared (with Errors and Warnings) for me which said that the first mentioned class in a cs code file must be the form class. I shifted my form class to the top of the files and everything was fine.

Share:
16,787
RickySpanish
Author by

RickySpanish

Updated on June 28, 2022

Comments

  • RickySpanish
    RickySpanish about 2 years

    Yesterday I edited a form in Visual Studio's form designer. When I returned to it today, the designer shows nothing. I can open the properties window, select all the different constituent components and edit their properties, but they do not show up. The application builds fine and the form can be run as usual.

    I've tried a couple of different solutions, such as checking the .csproj file has the form.Designer.cs included, but nothing has worked.

    Strangely, I did see this problem earlier in the week, but it fixed itself when I unlocked my computer after returning from a coffee break.

    Any suggestions?