You certainly can put a TabControl in a TabPage of another TabControl, but I agree with Sergey's opinion that this results in a poor user-interface experience. I've seen a UI where the TabControl-inside-a-TabPage displayed its Tabs vertically using TabControl.Alignment set to TabAlignment.Left: difficult to read the Tabs, imho. Also, note that even if you set the a TabPage's Font 'GdiVerticalFont property to 'true, it has no effect (not with any Font I have tried anyway): the font is not displayed in "truly" vertical fashion.
Keep in mind that you can create many TabPages at design-time inside a TabControl and configure their user interfaces as you like, wire-up EventHandlers for their Controls, and, at run-time, create a collection of them, then remove any of them you wish, and restore them from the collection when you need to. That involves some work, is not usually done, and if you are new to WinForms programming I would suggest you not take this on, but, it is possible.
The answer to the question you should be asking now is: yes, if you restore a removed TabPage to a TabControl from a valid collection of TabPages, the Event Handlers you have defined for its internal Controls are still there, and will fire events as expected.
For example, this removes all TabPages except the first one, and stores the removed TabPages in a List:
private List<tabpage> TheTabPages;
private void Form1_Load(object sender, EventArgs e)
{
TheTabPages = new List<tabpage>();
int tabCount = tabControl1.TabPages.Count;
for (int i = 1; i < tabCount; i++)
{
TabPage tb = tabControl1.TabPages[1];
Console.WriteLine(tb.Name);
TheTabPages.Add(tb);
tabControl1.TabPages.Remove(tb);
}
}
So, taking Sergey's excellent design suggestion of using a TreeView as a navigation tool for a hierarchy, and using Panel elements for each "node" of a hierarchy, you could associate ... using a Dictionary, for example ... Panels with TreeNodes, or a collection of Panels with TreeNodes that have child-nodes. I've done this myself.
My choice would be to define a UserControl for each UI to be displayed inside a selected Tab in a TabControl. I would define template UserControls containing common UI elements, and then create other UserControls that inherited from those templates.
So my application object graph might look like this:
Form MainForm
TabControl TabControl1
TreeView TreeView1
Other UI Elements
Other Forms ...
UserControl UCBase
UserControl UCTemplate1 inherits from UCBase
UserControl UCT1Child1 inherits from UCTemplate1
UserControl UCT1Child2 inherits from UCTemplate1
UserControl UCTemplate2 inherits from UCBase
UserControl UCT2Child1 inherits from UCTemplate2
UserControl UCT2Child2 inherits from UCTemplate2
There are other ways you could represent a hierarchy within TabPages:
1. Put a Menu inside each TabPage, use nesting in the Menu to determine which Panel of a collection of Panels inside the TabPage is visible.