Reputation: 41823
So I have an existing project with a custom tab control nested within panels and splitters etc.
Now I need to add something to one of the pages of this tab control through the design view.
However, when I view the form in question, the tab control is nowhere to be seen (and not in the drop down of current controls on the page).
The tab control is in the designer code and appears when you run.
Any advice for this probably noob question?
Edits
Okay, I probably should have mentioned this but I guess I forgot - the form is an inherited form. Some of the differences of this form from the inherited form are present, but not the tab control
Upvotes: 3
Views: 3713
Reputation: 4755
The tab control is probably Private in the base form. Try to set the Modifier property of the tab control to Protected or Public (from the designer of the base form).
If the control field is private it wont be available in the designer of inheriting forms, but it will still show up at runtime.
Update, new question by author
I dont know how it happened without somebody editing the csproj file in a text editor. But this example shows how a form include should look in the csproj.
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
This example will cause the behavior you described. (DependentUpon-tags removed).
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.designer.cs"/>
<EmbeddedResource Include="MainForm.resx">
<SubType>Designer</SubType>
</EmbeddedResource>
Upvotes: 3
Reputation: 41823
So..
I noticed that the .designer, .resx and form class code were all listed as separate files in Visual Studio (not automatically joining).
I have no idea what caused this and reverting source code + project didn't help.
However.. I decided to do what I should have done much earlier which was save the 3 files separately, remove them all through the Visual Studio interface, save the project, move the 3 files back and add them as existing items, before saving and rebuilding everything. After all this everything is fine again...
If anyone has a good idea why the three files separated I'll award the bounty there :-)
Thanks also for all the feedback above :-)
Upvotes: 0
Reputation: 1110
Have you tried adding a tab with some content to it? Sometimes the designer doesn't like to show you something that hosts content when there isn't any content to host.
Upvotes: 0