Export (0) Print
Expand All

TabControl.TabPages Property

Gets the collection of tab pages in this tab control.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public TabPageCollection TabPages { get; }
/** @property */
public TabPageCollection get_TabPages ()

public function get TabPages () : TabPageCollection

Property Value

A TabControl.TabPageCollection that contains the TabPage objects in this TabControl.

The order of tab pages in this collection reflects the order the tabs appear in the control.

The following code example creates a TabControl with one TabPage. This example uses the Add method to add a single tab page to the tabControl1 tab control. Notice the TabPages property is used to get the tabControl1 controls collection to add the tabPage1 to this collection.

Use the System.Drawing and System.Windows.Forms namespaces for this example.

using System.Drawing;
using System.Windows.Forms;

public class Form1 : Form
{
    private TabControl tabControl1;
    private TabPage tabPage1;

    public Form1()
    {
        this.tabControl1 = new TabControl();
        this.tabPage1 = new TabPage();

        // Gets the controls collection for tabControl1.
        // Adds the tabPage1 to this collection.
        this.tabControl1.TabPages.Add(tabPage1);

        this.tabControl1.Location = new Point(25, 25);
        this.tabControl1.Size = new Size(250, 250);

        this.ClientSize = new Size(300, 300);
        this.Controls.Add(tabControl1);
    }

    static void Main() 
    {
        Application.Run(new Form1());
    }
}

import System.Drawing.*;
import System.Windows.Forms.*;

public class Form1 extends Form
{
    private TabControl tabControl1;
    private TabPage tabPage1;

    public Form1()
    {
        this.tabControl1 = new TabControl();
        this.tabPage1 = new TabPage();
        // Gets the controls collection for tabControl1.
        // Adds the tabPage1 to this collection.
        this.tabControl1.get_TabPages().Add(tabPage1);

        this.tabControl1.set_Location(new Point(25, 25));
        this.tabControl1.set_Size(new Size(250, 250));

        this.set_ClientSize(new Size(300, 300));
        this.get_Controls().Add(tabControl1);
    } //Form1

    public static void main(String[] args)
    {
        Application.Run(new Form1());
    } //main
} //Form1

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft