I think I goofed up and my WinForms designer is missing now. I noticed this in my Form1.Designer.cs
file:
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
I deleted one line from this file because I accidentally added an extra button. I deleted it from the GUI designer but the code still remained. So I just deleted it.
My application compiles and runs correctly. But after poking around in Visual Studio for 20 minutes now & Googling I can't seem to get Form1.cs [Design]
file to come back.
Basically this file (pic taken from Google)
The Form1.cs [Design]
displayed some sort of error but I closed the tab. Now I can't seem to even get the tab back to see the problem.
Posting this to help others who may have this issue. The problem was that I created a class within my Form1.cs
file BEFORE my public partial class Form1 : Form
class. As described in this answer: https://stackoverflow.com/a/40243490/8887398
A key indicator this might be your problem is if your form looks like this in your solution explorer:
Notice the icon for Form1.cs looks like a regular C# file. This is how it should look if it's a form:
You can clearly see the difference in the icon. Simply making sure the public partial class Form1 : Form
class was first in the file instantly brought back the ability for me to open the Form1.cs [Design]
with a simple double click.
Thanks, worked fine for me. Just for those who have the same and who don't see the designer back instantly after the changes are made : exclude the cs form file from the projet and include it again. The file icon should update and the designer would show again by double-clicking on cs file.