none
How can I recover vb.[Design] pane in VS 2015 after renaming Form1? RRS feed

  • Question

  • My vb.net program was functioning properly.  After I renamed Form1 in the code pane of Visual Studio 2015 the Program.vb[Design] pane will not open and the following message appears:

     

    The class Form1 can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again.

     

    The name change was in the first class (form) so I cannot move it further up.

     

    Before the change there were no errors.  After the change there are many handles clause, variable not declared and not a member of errors.

     

    I had 2 choices for Startup form in the Application tab of My Project before the change.  After I have only 1 choice from a dropdown list.  Both choices were Class names.

     

    Is there anything I can do to recover the Designer view?  Should I just recreate the form?

     

    Thanks in advance, for any suggestions.
    Sunday, June 25, 2017 12:58 AM

All replies

  • Hi ChemTchr,

    Since it was related to the VB WinForm designer, I help you move this case to the VB forum for dedicated support.

    Thanks,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, June 29, 2017 7:03 AM
  • Is there anything I can do to recover the Designer view?  Should I just recreate the form?

    Examine each .VB file in your solution.  One of them will have a class defined at the start of the file that is not a form.  It is probably a class that has the original form name.  It is not a problem of changing the form position in the project - it is the class name for the class definition within one of the files.

    It might actually be easier to do this from Explorer using Notepad with the IDE shut down.  Note that a class definition can start with either 'Class <classname>' or 'Partial Class <classname>'.

    Thursday, June 29, 2017 7:14 AM
  • Hi ChemiTchr,

    I can reproduce your issue at my side.

    For example, I have one form as Form4, I need to rename as the newform. Right-click Form4---choose Rename---Enter Newform, then you will find this screenshot.

    Please choose Yes, and then click show all files, like the screenshot:

    Find the newform.Designer.vb, open this file and modify the class name.

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, June 29, 2017 7:26 AM
    Moderator