Unable to get the designer view window back using windows forms with Visual Studio 2010

后端 未结 15 1637
逝去的感伤
逝去的感伤 2020-12-20 11:08

I am in process of writing a C# Windows Forms application using Visual Studio Express 2010 ENU SP1. Further VS specifics are at the bottom of this post. I recently made so

相关标签:
15条回答
  • 2020-12-20 11:43

    Thanks for the thoughts. I just completely reinstalled both the Express and evaluation copies of the Team versions of VS 2010 and it is now magically working. I have no idea what caused the problem nor what fixed it but I'm now back on track. I probably should have done that before asking on this forum.

    0 讨论(0)
  • I had the same issue in VS 2010. I was not able to view the designer form(Connect.CS).

    i already had the

    <Compile Include="Connect.cs">
      <SubType>Code</SubType>
    </Compile>
    <Compile Include="Connect.Designer.cs">
      <DependentUpon>Connect.cs</DependentUpon>
    </Compile>
    

    tags in the ItemGroup Tag, but still i wasn't able to view the Designer.

    I was using name space directive 'Using RFCOMAPILib', which already had a Form element in it and it clashed with the System.Windows.Forms.Form.

    After replacing 'public partial class Connect : Form' to 'public partial class Connect : System.Windows.Forms.Form' im able to view the Designer now.

    0 讨论(0)
  • 2020-12-20 11:45

    I had the same problem but mine was caused on VS2012 by dragging and dropping some of the forms into different folders.

    David's solution above was helpful towards fixing it, but didn't go all the way.

    If you have the form in a sub-folder the Compile Include line should read like this:

    <Compile Include="SubFolderName\MyForm.Designer.cs">
        <DependentUpon>MyForm.cs</DependentUpon>
    </Compile>
    

    Please note that the sub-folder name is needed in the first line but not in the second line.

    I also had to change the EmbeddedResource line further down the file to associate the resx file:

       <EmbeddedResource Include="SubFolderName\MyForm.resx">
            <DependentUpon>MyForm.cs</DependentUpon>
        </EmbeddedResource>
    

    Again, note that the first line mentions the sub-folder whereas the second line doesn't.

    0 讨论(0)
  • 2020-12-20 11:48

    I had the same problem with VB. Thanks for the hints. I found the same issues in the .vbproj with my UserControl.

    I had this in the .vbproj file:

    <Compile Include="AddCommunicationTask.vb" />
    

    And changed it to this:

    <Compile Include="AddCommunicationTask.vb">
       <SubType>UserControl</SubType>
    </Compile>
    

    When I reloaded it I was still having problems and realised that I had written another class in above the form class, this was causing the error. The form class must be first. All I had to do was move my class down and make the form class the top one.

    I hope this helps others - good luck!

    p.s - I am using vs Community 2015

    0 讨论(0)
  • 2020-12-20 11:49

    Make sure you don't have any class declared before your designer partial class. The .cs file needs to have the partial designer class as the first class in the file.

    public partial class frmWidget : Form
    {
    }
    
    public class SomeClass
    {
    }
    

    Now SomeClass cannot be on top of the partial frmWidget class. Once you re-arrange that then it will automatically fix the designer issue and no need to restart VS or re-create the form. I hope this helps.

    0 讨论(0)
  • 2020-12-20 11:53

    I had the same problem and I got the (Design) window back by double clicking the Form1.cs file in the Solution Explorer (not the Form1.Designer.cs file).

    0 讨论(0)
提交回复
热议问题