# TabControl.TabPageCollection

Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (4.0.0.0)

Contains a collection of [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) objects.

{% tabs %}
{% tab title="C#" %}

```csharp
public class TabPageCollection : IList, ICollection, IEnumerable, IList<TabPage>, ICollection<TabPage>, IEnumerable<TabPage>
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class TabPageCollection
    Inherits IList
    Implements ICollection, IEnumerable, IList(Of TabPage), ICollection(Of TabPage), IEnumerable(Of TabPage)
```

{% endtab %}
{% endtabs %}

## Properties

### ![](/files/hsR4ok3152WyAf8J2C1u) Count

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns the number of tab pages in the collection.

### ![](/files/hsR4ok3152WyAf8J2C1u) Item(index)

[TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md): Returns or sets a [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) in the collection at the specified index.

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)*index* is less than zero or greater than the highest available index.
* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)*value* is null.

### ![](/files/hsR4ok3152WyAf8J2C1u) Item(name)

[TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md): Returns the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) with the specified key from the collection.

## Methods

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(tabPage)

Adds a [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) to the collection.

| Parameter   | Type                                                                 | Description                                                                      |
| ----------- | -------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| **tabPage** | [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) | The [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) to add. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  The specified *tabPage* is null.

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(text)

Creates a [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) with the specified text, and adds it to the collection.

| Parameter | Type                                                          | Description                                                                                      |
| --------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display on the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md). |

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(key, text)

Creates a [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) with the specified key and text and adds it to the collection.

| Parameter | Type                                                          | Description                                                                                      |
| --------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md).            |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display on the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md). |

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(key, text, imageIndex)

Creates a [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) with the specified key, text, and image, and adds it to the collection.

| Parameter      | Type                                                          | Description                                                                                                    |
| -------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| **key**        | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md).                          |
| **text**       | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display on the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md).               |
| **imageIndex** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The index of the image to display on the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md). |

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(key, text, imageKey)

Creates a [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) with the specified key, text, and image, and adds it to the collection.

| Parameter    | Type                                                          | Description                                                                                                  |
| ------------ | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| **key**      | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md).                        |
| **text**     | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display on the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md).             |
| **imageKey** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The key of the image to display on the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md). |

### ![](/files/hsR4ok3152WyAf8J2C1u) AddRange(pages)

Adds a set of [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) pages to the collection.

| Parameter | Type                                                                     | Description                                                                                                                                                                                |
| --------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **pages** | [TabPage\[\]](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) | An array of type [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) that contains the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) pages to add. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  The value of pages is null.

### ![](/files/hsR4ok3152WyAf8J2C1u) Clear()

Removes all the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) pages from the collection.

### ![](/files/hsR4ok3152WyAf8J2C1u) Clear(dispose)

Removes and disposes all [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) pages from the collection.

| Parameter   | Type                                                            | Description                                                                                                                              |
| ----------- | --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| **dispose** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | Indicates whether to dispose the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) pages removed from the collection. |

### ![](/files/hsR4ok3152WyAf8J2C1u) Contains(tabPage)

Determines whether a specified [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) is in the collection.

| Parameter   | Type                                                                 | Description                                                                                           |
| ----------- | -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| **tabPage** | [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) | The [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) to locate in the collection. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the specified [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) is in the collection; otherwise, false.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  The value of *tabPage* is null.

### ![](/files/hsR4ok3152WyAf8J2C1u) ContainsKey(key)

Determines whether the collection contains a [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) with the specified key.

| Parameter | Type                                                          | Description                                                                                              |
| --------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) page to search for. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true to indicate a [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) page with the specified key was found in the collection; otherwise, false.

### ![](/files/hsR4ok3152WyAf8J2C1u) CopyTo(array, index)

Copies the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) pages in the collection to the specified array, starting at the specified index.

| Parameter | Type                                                                     | Description                                                                                                                             |
| --------- | ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
| **array** | [TabPage\[\]](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) | The one-dimensional array that is the destination of the tab pages copied from the collection. The array must have zero-based indexing. |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)              | The zero-based index in the array at which copying begins.                                                                              |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)*array* is null.
* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)*array* is less than zero.
* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception)*array* is multidimensional or the number of elements in the [TabPageCollection](/api/wisej.web/containers/tabcontrol/wisej.web.tabcontrol.tabpagecollection.md) is greater than the available space from index to the end of *array* .

### ![](/files/hsR4ok3152WyAf8J2C1u) IndexOf(tabPage)

Returns the index of the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) in the collection.

| Parameter   | Type                                                                 | Description                                                                                           |
| ----------- | -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| **tabPage** | [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) | The [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) to locate in the collection. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The zero-based index of the tab page; -1 if it cannot be found.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  The value of *tabPage* is null.

### ![](/files/hsR4ok3152WyAf8J2C1u) IndexOfKey(key)

Returns the index of the first occurrence of the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) with the specified key.

| Parameter | Type                                                          | Description                                                                                                     |
| --------- | ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) to find in the collection. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The zero-based index of the first occurrence of a [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) with the specified key, if found; otherwise, -1.

### ![](/files/hsR4ok3152WyAf8J2C1u) Insert(index, tabPage)

Inserts an existing [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) into the collection at the specified index.

| Parameter   | Type                                                                 | Description                                                                                                                    |
| ----------- | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| **index**   | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)          | The zero-based index location where the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) page is inserted. |
| **tabPage** | [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) | The [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) to insert in the collection.                          |

### ![](/files/hsR4ok3152WyAf8J2C1u) Insert(index, text)

Creates a new [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) with the specified text and inserts it into the collection at the specified index.

| Parameter | Type                                                          | Description                                                                                                                    |
| --------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The zero-based index location where the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) page is inserted. |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display in the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) page.                          |

### ![](/files/hsR4ok3152WyAf8J2C1u) Insert(index, key, text)

Creates a new [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) with the specified key and text, and inserts it into the collection at the specified index.

| Parameter | Type                                                          | Description                                                                                                               |
| --------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The zero-based index location where the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) is inserted. |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md).                                     |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display on the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md).                          |

### ![](/files/hsR4ok3152WyAf8J2C1u) Insert(index, key, text, imageIndex)

Creates a new [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) with the specified key, text, and image, and inserts it into the collection at the specified index.

| Parameter      | Type                                                          | Description                                                                                                               |
| -------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **index**      | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The zero-based index location where the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) is inserted  |
| **key**        | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the tab page.                                                                                                 |
| **text**       | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display on the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md).                          |
| **imageIndex** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The zero-based index of the image to display on the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md). |

### ![](/files/hsR4ok3152WyAf8J2C1u) Insert(index, key, text, imageKey)

Creates a [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) with the specified key, text, and image, and inserts it into the collection at the specified index.

| Parameter    | Type                                                          | Description                                                                                                               |
| ------------ | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **index**    | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The zero-based index location where the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) is inserted. |
| **key**      | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the tab page.                                                                                                 |
| **text**     | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display on the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md).                          |
| **imageKey** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The key of the image to display on the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md).              |

### ![](/files/hsR4ok3152WyAf8J2C1u) Remove(tabPage)

Removes the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) from the collection.

| Parameter   | Type                                                                 | Description                                                                         |
| ----------- | -------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| **tabPage** | [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) | The [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) to remove. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  The *tabPage* parameter is null.

### ![](/files/hsR4ok3152WyAf8J2C1u) RemoveAt(index)

Removes the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) at the specified index from the collection.

| Parameter | Type                                                        | Description                                                                                                 |
| --------- | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | The zero-based index of the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) to remove. |

### ![](/files/hsR4ok3152WyAf8J2C1u) RemoveByKey(key)

Removes the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) with the specified key from the collection.

| Parameter | Type                                                          | Description                                                                                          |
| --------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) page to remove. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/api/wisej.web/containers/tabcontrol/wisej.web.tabcontrol.tabpagecollection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
