none
form1.cs [Design] "the designer cannot process code at line"

    Question

  • I made some changes to my C code in Visual Studio (Visual C# 2013) and ran the code successfully.  When I went back to the code Design view, I got an error message "form1.cs [Design]  The designer cannot process code at line xxxx".  The line was:

                this.lblPollDot.TabIndex = 189;

    when I comment out this line, the error jumps to the previous line:

                this.lblPollDot.Size = new System.Drawing.Size(24, 21);

    As I comment out the lines, the error simply moves to the line above the commented line.

    What is odd is the code compiles and runs properly, I just can't view or make changes to form1.cs [Design].  I even went as far as commenting out all references to lblPollDot in Form1.Designer.cs but that did not help.

    What can I do to get form1.cs [Design] back?

    Thanks.

    Saturday, December 05, 2015 5:59 PM

Answers

  • Thorsten,

    I gave up on trying to figure out what was wrong with initializecomponents, mainly because the code was too long.  I did however manage to replicate the BUG on a very simple app.

    There are many ways to work around this bug, but here is what I was trying to do.  I wanted a small blinking "dot" in my app to indicate serial communication.

    In Excel, in cell A1, type: 7

    In cell B1 type: =char(A1)

    cell B1 should be a "dot".

    I am using VB Express 2013.

    Open a new project: Visual c# - Windows Form Application

    Add a label - label1

    In Excel, click on cell B1, right click and copy.

    In Visual Studio, Under Properties for label1 - Text - paste the "dot".

    Run the app.

    Close the project and Visual Studio.

    Open the project in Visual Studio.

    Voila - you won't be able to view the Designer File!

    As I mentioned above, there are many ways to make a flashing dot, so don't waste time trying to track down what is actually happening.  I just added the above explanation for the curious.

    Cheers, Ken

    Tuesday, December 08, 2015 6:04 PM

All replies

  • Hi,

    what I'd do in this situation would be commenting out everything in the initializecomponent method except the initialization of the controls and maybe the adding of the controls to the form's control collection.

    If the error still is present then, look at each controls instantiation carefully. If the error is gone then, remove the comments blockwise, per control.

    Regards,

      Thorsten

    Saturday, December 05, 2015 7:11 PM
  • Thorsten,

    I may give your suggestion a however it may be a weeks worth of work since the initializecomponents section is almost 7000 lines long!

    I am strongly leaning towards a bug in Visual Studio Express as I recovered a previously working version, made changes to the code that I was trying to make previously, compiled and ran the code successfully. This morning, when I reloaded the code, exactly the same problem showed up again.  The changes were fairly minor so I should be able to create a case showing how the "bug" was created (when I have time).

    Ken

    Tuesday, December 08, 2015 5:05 PM
  • Thorsten,

    I gave up on trying to figure out what was wrong with initializecomponents, mainly because the code was too long.  I did however manage to replicate the BUG on a very simple app.

    There are many ways to work around this bug, but here is what I was trying to do.  I wanted a small blinking "dot" in my app to indicate serial communication.

    In Excel, in cell A1, type: 7

    In cell B1 type: =char(A1)

    cell B1 should be a "dot".

    I am using VB Express 2013.

    Open a new project: Visual c# - Windows Form Application

    Add a label - label1

    In Excel, click on cell B1, right click and copy.

    In Visual Studio, Under Properties for label1 - Text - paste the "dot".

    Run the app.

    Close the project and Visual Studio.

    Open the project in Visual Studio.

    Voila - you won't be able to view the Designer File!

    As I mentioned above, there are many ways to make a flashing dot, so don't waste time trying to track down what is actually happening.  I just added the above explanation for the curious.

    Cheers, Ken

    Tuesday, December 08, 2015 6:04 PM
  • Thanks for sharing your solution here, vbssken:)

    >>As I mentioned above, there are many ways to make a flashing dot, so don't waste time trying to track down what is actually happening.  I just added the above explanation for the curious.

    Since you would use this workaround, I will mark your reply as the answer, and close this case for you.

    In addition, actually this forum is to discuss the VS IDE usage, if you meet any WinForm developing issue in the furture, you could post this issue to the Winform forum:

    https://social.msdn.microsoft.com/Forums/windows/en-US/home?forum=winforms

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, December 09, 2015 8:04 AM
    Moderator