问题
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