I have an application with a main form, and a TabControl in the centre. When a user creates a new tab I want to have controls (Textboxes and labels etc) loaded onto the tab.

I was thinking of creating my own class that have these controls already defined in it.
I guess I will have to inherit the Tabpage class, have a custom initializing method to put my controls on-screen?

Then create a new object in the Main form:
CustomTabPage custTabPage = new CustomTabPage();


I'm just guessing at the moment. Can someone guide me in the right direction?


Hello johnnyturbo3,
You have got right direction. I have tried to recreate your task. Working very well.

class MyTabClass:TabPage

        public MyTabClass()
            TextBox textbox = new TextBox
                Width = 100,
                Height = 25,
                Left = 25,
                Top = 25



/* call from form

     private void button2_Click(object sender, EventArgs e)
            MyTabClass tab = new MyTabClass();

You can set any parameters for your class:
text, name....


There is an annoyance with the class file that I've create for the custom Tabpage. Because I inherit the System.Windows.Forms.TabPage, Visual Studio thinks that my class is actually a Form, and thus has a Designer View and several warnings etc.

Is there anyway to inherit System.Windows.Forms.TabPage and not make the class think it's a Form?