Reputation: 3882
I have a base form BaseForm
which I use for saving settings. This form have no controls in it and it's opened in the designer as an empty form. However, when I inherit this form, the designer refuses to open the newly created form in the designer (there's no button View in Designer). What may be the problem ? Thanks
Upvotes: 2
Views: 1444
Reputation: 3882
The problem is with the .csproj
file.
Every form has a signature in the file like this
<Compile Include="Opers\MyForm.cs">
<SubType>Form</SubType>
</Compile>
The SubType
element says that this is actually a form and in my file this was deleted for some reason.
Upvotes: 3
Reputation: 1084
I would highly recommend to avoid inheriting forms whenever possible. For saving settings, this is surely avoidable: make yourself an FormSettingsSaver class or something like that and pass it the form as argument when loading/closing, etc. Inheriting forms can make a lot of headaches and MS isn´t really putting any work in WindowsForms and/or the Designer.
edit: if you want to stick with inheriting forms, check the link from rene in the comment. Most designer problems can be avoided with checking for DesignMode. You could also try to comment out statements until you find the culprit. All code in the constructor and (i think) OnLoad is executed when the form is displayed in the Designer, so there would be a good place to start.
Upvotes: 2