You should not edit the designer.cs file manually and there's a comment in code about it:
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
Assuming your form is calles Form1
, if you have a correct build for the application, and if the content of Form1.designer.cs
are still there, then the only thing that you need to do is making sure that there's a constructor like this in Form1.cs
:
public Form1()
{
InitializeComponent();
}
In some rare cases, you may need close all designer windows, then close Visual Studio, delete bin and obj folders, open the solution and rebuild it again. then open designers.
You should also use a source control system like git which is integrated with Visual Studio, then in case of such events, you can easily discard changes or restore the working instance of the form.