Accidentally change the generated code in Student_Form.Designer.cs

BenTam-3003 686 Reputation points
2022-03-14T14:22:02.583+00:00

Dear All,

Accidentally change the generated code in Student_Form.Designer.cs. Then I can't open the "Student_From.cs [Design]". The error message:

  "The designer cannot process unknown name 'Contact_peron_label' at line43. 
   The code within the method 'InitializeComponent' is generated by the designer
   and should not be manually modified, Please remove any changes and try
   opening the designer and try opening the designer again"

I plan to re-create the Student_Form. Any other better suggestion?

Developer technologies | C#
{count} votes

Accepted answer
  1. Michael Taylor 60,326 Reputation points
    2022-03-14T14:25:08.203+00:00

    Whether you need to start over with this form or not depends upon the extent of your changes but if it is just this error then it can be resolved.

    1. Open the designer window for the form to trigger the YSOD.
    2. In the top right corner is the Go to Code link, click it.
    3. You should be thrown onto the line of code that cannot find the identifier that is listed in your error.
    4. Fix the error
    5. Close the designer.cs file and the designer window should refresh correctly.

    To fix the error, it depends upon what change you made.

    If you renamed the field then fix the identifier in the designer file to match it. If you removed the field then remove all references to that field in the designer file.


0 additional answers

Sort by: Most helpful

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.