This documentation is archived and is not being maintained.

TabControl.TabPageCollection.AddRange Method

Adds a set of tab pages to the collection.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public void AddRange(
	TabPage[] pages


Type: System.Windows.Forms.TabPage[]
An array of type TabPage that contains the tab pages to add.


The value of pages equals null.

The following code example creates a TabControl with three TabPage. This example uses the AddRange method to add an array of tab pages to the tabControl1 tab control. Notice that the TabPages property gets the tabControl1 controls collection, in order to add the array of tab pages to this collection.

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

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

public class Form1 : Form
    private TabControl tabControl1;
    private TabPage tabPage1;
    private TabPage tabPage2;
    private TabPage tabPage3;

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

        // Gets the controls collection for tabControl1.
        // Adds an array of tab pages to this collection.
        this.tabControl1.Controls.AddRange(new TabPage[] {
            tabPage1, tabPage2, tabPage3});

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

        this.ClientSize = new Size(300, 300);

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

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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