Reputation: 3823
I am trying to design some "standalone" tab-pages and later on, I want to add them dynamically to a tab-control in my main form. Visual Studio won't let me open the class extended with TabPage
in the designer. Some idea?
using System;
using System.Windows.Forms;
namespace Test.View.Panels {
public class MainStatusTabPage : TabPage {
public MainStatusTabPage() {
}
}
}
When I right-click the class in the Solution Explorer and selecting "View Designer", I get the following message (the Designer doesn't show up):
To add components to your class, drag them from the Toolbox and use the Properties window to set their properties. To create methods and events for your class, switch to code view.
Upvotes: 2
Views: 228
Reputation: 8004
When I right-click the class in the Solution Explorer and selecting "View Designer", I get the following message (the Designer doesn't show up): To add components to your class, drag them from the Toolbox and use the Properties window to set their properties. To create methods and events for your class, switch to code view.
This is normal behavior as a TabPage
is just a container that holds other controls, nothing more. As @PanagiotisKanavos mentioned above:
A Tab Page is a container, not the actual content of the tab. In all examples that use complex content you'll see that the content is a custom component, eg a User control, that's added into the tab
With this in mind, you can just create a UserControl
with all the other controls you would need and then add this new instance (UserControl) to the TabPage
itself.
Upvotes: 1