Search code examples
c#classvisual-studio-2012designertabpage

Open Custom TabPage in Designer of Visual Studio


I have created a custom class which inherits from System.Windows.Forms.TabPage, and is actually a TabPage with many buttons and different stuff in it. I created this because I wanted to have the user add dynamically as many tabs as he would like at runtime.

The problem I have here is that I can't find a way to have the Visual Studio designer let me design that custom TabPage easily, without me having write all the needed code manually (the way I've been doing it until now).

Is that even possible?


Solution

  • Rather than designing the tab page itself, consider designing a 'UserControl', and then inserting that onto the tab page, with its Dock property set to Full.

    You can use the VS designer on a UserControl to arrange its children.

    Then the programmatic bit just consists of constructing the UserControl and adding it to the TabPage's controls list.