This documentation is archived and is not being maintained.

How to: Add a Control to a Tab Page

You can use the Windows Forms TabControl to display other controls in an organized fashion. The following procedure shows how to display a picture on the main part of a tab page. For information about adding an icon to the label part of a tab page, see How to: Change the Appearance of the Windows Forms TabControl.

To add a control programmatically

  • Use the Add method of the collection returned by the Controls property of TabPage:

    ' Assuming that TabControl1 exists and has at least one tab page
    ' Add a button to the first tab page
    TabPage1.Controls.Add(New Button())
    
    

    // Assuming that tabControl1 exists and has at least one tab page
    // Add a button to the first tab page
    tabPage1.Controls.Add(new Button());
    
    

    // Assuming that tabControl1 exists and has at least one tab page
    // Add a button to the first tab page
    tabPage1.get_Controls().Add(new Button());
    

    // Assuming that tabControl1 exists and has at least one tab page
    // Add a button to the first tab page
    tabPage1->Controls->Add(gcnew Button());
    

See Also

Show: