Reputation: 1524
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.
Upvotes: 4
Views: 18496
Reputation: 1
music-database-app-sql.sln
, obv your file structure will be different--> new interface will showform1.cs
View Designer
Upvotes: 0
Reputation: 5890
I'll use this post to show my solution. I have a solution with 30 projects, 5 of them are WinForms apps. Everything being equal - it was possible to design forms in four of those, only one was "code only".
What worked for me was:
Upvotes: 2
Reputation: 1524
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.
Upvotes: 17