Not able to open a form in design mode

感情迁移 提交于 2020-07-21 06:26:47

问题


When i open form, i can't get into design mode and i get this error:

The variable 'MonthViewCalendar'
    (internal 
        Infragistics.Win.UltraWinSchedule.UltraMonthViewSingle 
        MonthViewCalendar;)
is either undeclared or was never assigned. 

Any idea why a form doesn't go into design mode? I am using VS 2010.

I tried - Clean solution, restarting VS and reopening, but that didn't solve my issue.


回答1:


Go into your Form.Designer.cs file and remove the declaration for "abcd". Then reload it in your designer.




回答2:


Sometimes you may find that the project file loses the correct subtype that the file needs to open in design mode.

To fix:

  • Shutdown VS, then edit the projects ".csproj" file using a text editor
  • Look for the <Compile Include="MyFile.cs">
  • If there's no "<SubType>Form</SubType>" then add it back in as follows

    <Compile Include="MyForm.cs"> <SubType>Form</SubType> </Compile>




回答3:


Often, it can happen if you insert a new class above an implementation of the class.




回答4:


What works for me is to close and relaunch Visual Studio, then rebuild. After that the form can be opened in design mode. I wouldn't say I particularly like my solution, but I haven't come up with a more sure-fire solution.

Edit: I've only ever encountered this problem when there's an Infragistics control on the form.



来源:https://stackoverflow.com/questions/9523242/not-able-to-open-a-form-in-design-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!