# TabControl

Namespace: **Wisej.Web**

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

* [Control](/api/v3.0/wisej.web/general/control.md)
  * [TabControl](/api/v3.0/wisej.web/containers/tabcontrol.md)

Manages a related set of [TabPage](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) pages.

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

```csharp
public class TabControl : Control
```

{% endtab %}

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

```visual-basic
Public Class TabControl
    Inherits Control
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](/files/uCY6T77rh488FWHzpJ6P)TabControl()

Initializes a new instance of the [TabControl](/api/v3.0/wisej.web/containers/tabcontrol.md) class.

## Properties

### ![](/files/uCY6T77rh488FWHzpJ6P)Alignment

[TabAlignment](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabalignment.md): Returns or sets the area of the control (for example, along the top) where the tabs are aligned.

### ![](/files/uCY6T77rh488FWHzpJ6P)AllowUserToMoveTabs

[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean): Returns or sets whether the user can change the position of a tab button by dragging it.

### ![](/files/uCY6T77rh488FWHzpJ6P)BorderStyle

[BorderStyle](/api/v3.0/wisej.web/enumerations/wisej.web.borderstyle.md): Indicates the border style for the control.

### ![](/files/uCY6T77rh488FWHzpJ6P)Display

[Display](/api/v3.0/wisej.web/enumerations/wisej.web.display.md): Returns or sets the [Display](/api/v3.0/wisej.web/enumerations/wisej.web.display.md) mode of the control to determine whether to display the icon, the text or both.

### ![](/files/uCY6T77rh488FWHzpJ6P)DisplayRectangle

[Rectangle](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.rectangle): Returns the display area of the control's tab pages.

### ![](/files/uCY6T77rh488FWHzpJ6P)ImageList

[ImageList](/api/v3.0/wisej.web/content/imagelist.md): Returns or sets the images to display on the control's tabs.

### ![](/files/uCY6T77rh488FWHzpJ6P)ItemSize

[Size](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.size): Returns or sets the fixed size of the tab buttons. The default value is [Empty](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.size.empty) to use the itemSize set in the current theme or auto sizing.

When set to [Empty](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.size.empty) (default) it uses the itemSize set in the theme. You can also set only the width or the height and leave the other value set to 0 to use the value in the current theme or auto sizing. The width (or height when [Alignment](#alignment) is [Left](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabalignment.md#fields) or [Right](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabalignment.md#fields)) is applied when the value [SizeMode](#sizemode) is [Fixed](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabsizemode.md#fields) or [Center](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabsizemode.md#fields). The height (or width when [Alignment](#alignment) is [Top](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabalignment.md#fields) or [Bottom](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabalignment.md#fields)) is applied always.

### ![](/files/uCY6T77rh488FWHzpJ6P)Orientation

[Orientation](/api/v3.0/wisej.web/enumerations/wisej.web.orientation.md): Returns or sets a value indicating the horizontal or vertical orientation of the [TabControl](/api/v3.0/wisej.web/containers/tabcontrol.md) tabs.

### ![](/files/uCY6T77rh488FWHzpJ6P)RowCount

[Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32): Returns the number of rows that are currently being displayed in the control's tab strip.

### ![](/files/uCY6T77rh488FWHzpJ6P)ScrollStep

[Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32): Returns or sets the number of pixels to scroll when the scroll buttons are pressed.

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentoutofrangeexception) The value is less than 1 or greater than 500.

### ![](/files/uCY6T77rh488FWHzpJ6P)SelectedIndex

[Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32): Returns or sets the index of the currently selected tab page.

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentoutofrangeexception) The value is less than -1.

### ![](/files/uCY6T77rh488FWHzpJ6P)SelectedTab

[TabPage](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabpage.md): Returns or sets the currently selected tab page.

### ![](/files/uCY6T77rh488FWHzpJ6P)ShowToolTips

[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean): Returns or sets whether a tab's ToolTip is shown when the mouse passes over the tab.

### ![](/files/uCY6T77rh488FWHzpJ6P)ShowVisibilityMenu

[Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean): Returns or sets whether the tab visibility menu button is visible.

### ![](/files/uCY6T77rh488FWHzpJ6P)SizeMode

[TabSizeMode](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabsizemode.md): Returns or sets whether the tab buttons should fill the control's size, or placed in the center, or use the size set in [ItemSize](#itemsize).

### ![](/files/uCY6T77rh488FWHzpJ6P)TabCount

[Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32): Gets the number of tabs in the tab strip.

### ![](/files/uCY6T77rh488FWHzpJ6P)TabPages

[TabPageCollection](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabcontrol.tabpagecollection.md): Returns the collection of tab pages in this tab control.

## Methods

### ![](/files/uCY6T77rh488FWHzpJ6P)DeselectTab(index)

Makes the tab following the tab with the specified index the current tab.

| Parameter | Type                                                              | Description                                                               |
| --------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) | The index in the [TabPages](#tabpages) collection of the tab to deselect. |

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentoutofrangeexception) *index* is less than 0 or greater than the number of [TabPage](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) controls in the [TabPages](#tabpages) collection minus 1.

### ![](/files/uCY6T77rh488FWHzpJ6P)DeselectTab(tabPage)

Makes the tab following the specified [TabPage](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) the current tab.

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

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) *tabPage* is null.

### ![](/files/uCY6T77rh488FWHzpJ6P)DeselectTab(tabPageName)

Makes the tab following the tab with the specified name the current tab.

| Parameter       | Type                                                                | Description                                                                     |
| --------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| **tabPageName** | [String](https://docs.microsoft.com/en-us/dotnet/api/system.string) | The [Name](/api/v3.0/wisej.web/general/control.md#name) of the tab to deselect. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) *tabPageName* is null; or *tabPageName* does not match the [Name](/api/v3.0/wisej.web/general/control.md#name) property of any [TabPage](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) in the [TabPages](#tabpages) collection.

### ![](/files/uCY6T77rh488FWHzpJ6P)GetControl(index)

Returns the [TabPage](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) control at the specified location.

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

**Returns:** [Control](/api/v3.0/wisej.web/general/control.md). The [TabPage](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) at the specified location.

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentoutofrangeexception) *index* is less than 0 or greater than the number of [TabPage](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) controls in the [TabPages](#tabpages) collection minus 1.

### ![](/files/uCY6T77rh488FWHzpJ6P)GetTabRect(index)

Returns the bounding rectangle for the tab button of the [TabPage](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) at the specified *index* in this [TabControl](/api/v3.0/wisej.web/containers/tabcontrol.md) control.

| Parameter | Type                                                              | Description                                                                                          |
| --------- | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) | The zero-based index of the tab page for which to retrieve the bounding rectangle of the tab button. |

**Returns:** [Rectangle](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.rectangle). A [Rectangle](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.rectangle) that represents the bounds of the specified tab.

Bounding rectangles for the tab buttons are received from the client and are updated asynchronously. If the application adds a tab page, or changes any property that causes the tab button to be resized (orientation, sizing, text, alignment, etc.) it cannot immediately after retrieve the new bounds. When the tab rectangles are updated, the [TabControl](/api/v3.0/wisej.web/containers/tabcontrol.md) will fire the [StyleChanged](/api/v3.0/wisej.web/general/control.md#stylechanged) event to inform the application that the bounding rectangles have been updated. In alternative, you can use the [GetTabRect](#gettabrect-index) and [GetTabRectAsync](#gettabrectasync-index) overloads to query the client and receive the new bounding rectangle for the request tab page. Bounding rectangles are always empty until the [TabControl](/api/v3.0/wisej.web/containers/tabcontrol.md) has been rendered on the client. **Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentoutofrangeexception) The index is less than zero; or the index is greater than or equal to [TabCount](#tabcount).

### ![](/files/uCY6T77rh488FWHzpJ6P)GetTabRect(index, callback)

Retrieves the bounding rectangle for the tab button of the [TabPage](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) at the specified *index* in this [TabControl](/api/v3.0/wisej.web/containers/tabcontrol.md) control.

| Parameter    | Type                                                                            | Description                                                                                          |
| ------------ | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| **index**    | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)               | The zero-based index of the tab page for which to retrieve the bounding rectangle of the tab button. |
| **callback** | [Action\<Rectangle>](https://docs.microsoft.com/en-us/dotnet/api/system.action) | Callback method that will receive the bounding rectangle for the request tab button.                 |

Bounding rectangles are always empty until the [TabControl](/api/v3.0/wisej.web/containers/tabcontrol.md) has been rendered on the client. **Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentoutofrangeexception) The index is less than zero; or the index is greater than or equal to [Count](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabcontrol.tabpagecollection.md#count).
* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) The callback method is null.

### ![](/files/uCY6T77rh488FWHzpJ6P)GetTabRectAsync(index)

Retrieves the bounding rectangle for the tab button of the [TabPage](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) at the specified *index* in this [TabControl](/api/v3.0/wisej.web/containers/tabcontrol.md) control.

| Parameter | Type                                                              | Description                                                                                          |
| --------- | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) | The zero-based index of the tab page for which to retrieve the bounding rectangle of the tab button. |

**Returns:** [Task\<Rectangle>](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task).

Bounding rectangles are always empty until the [TabControl](/api/v3.0/wisej.web/containers/tabcontrol.md) has been rendered on the client. **Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentoutofrangeexception) The index is less than zero; or the index is greater than or equal to [Count](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabcontrol.tabpagecollection.md#count).

### ![](/files/uCY6T77rh488FWHzpJ6P)SelectTab(index)

Makes the tab with the specified index the current tab.

| Parameter | Type                                                              | Description                                                             |
| --------- | ----------------------------------------------------------------- | ----------------------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32) | The index in the [TabPages](#tabpages) collection of the tab to select. |

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentoutofrangeexception) *index* is less than 0 or greater than the number of [TabPage](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) controls in the [TabPages](#tabpages) collection minus 1.

### ![](/files/uCY6T77rh488FWHzpJ6P)SelectTab(tabPage)

Makes the specified [TabPage](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) the current tab.

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

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) *tabPage* is null.

### ![](/files/uCY6T77rh488FWHzpJ6P)SelectTab(tabPageName)

Makes the tab with the specified name the current tab.

| Parameter       | Type                                                                | Description                                                                   |
| --------------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| **tabPageName** | [String](https://docs.microsoft.com/en-us/dotnet/api/system.string) | The [Name](/api/v3.0/wisej.web/general/control.md#name) of the tab to select. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) *tabPageName* is null; or *tabPageName* does not match the [Name](/api/v3.0/wisej.web/general/control.md#name) property of any [TabPage](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) in the [TabPages](#tabpages) collection.

## Events

### ![](/files/uCY6T77rh488FWHzpJ6P)Deselected

[TabControlEventHandler](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabcontroleventhandler.md) Fired when a tab is deselected.

### ![](/files/uCY6T77rh488FWHzpJ6P)Deselecting

[TabControlCancelEventHandler](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabcontrolcanceleventhandler.md) Occurs before a tab is deselected, enabling a handler to cancel the tab change.

### ![](/files/uCY6T77rh488FWHzpJ6P)ScrollStepChanged

[EventHandler](https://docs.microsoft.com/en-us/dotnet/api/system.eventhandler) Fired when the value of [ScrollStep](#scrollstep) changes.

### ![](/files/uCY6T77rh488FWHzpJ6P)Selected

[TabControlEventHandler](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabcontroleventhandler.md) Fired when a tab is selected.

### ![](/files/uCY6T77rh488FWHzpJ6P)SelectedIndexChanged

[EventHandler](https://docs.microsoft.com/en-us/dotnet/api/system.eventhandler) Fired when the [SelectedIndex](#selectedindex) property has changed.

### ![](/files/uCY6T77rh488FWHzpJ6P)Selecting

[TabControlCancelEventHandler](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabcontrolcanceleventhandler.md) Occurs before a tab is selected, enabling a handler to cancel the tab change.

### ![](/files/uCY6T77rh488FWHzpJ6P)TabClosed

[TabControlEventHandler](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabcontroleventhandler.md) Occurs after a tab is closed by the user and has been removed from the tab control.

### ![](/files/uCY6T77rh488FWHzpJ6P)TabClosing

[TabControlCancelEventHandler](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabcontrolcanceleventhandler.md) Occurs before a tab is closed by the user, enabling a handler to cancel the tab closing.

### ![](/files/uCY6T77rh488FWHzpJ6P)TabVisibilityChanged

[TabControlEventHandler](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabcontroleventhandler.md) Occurs after a tab is shown or hidden by the user through the [ShowVisibilityMenu](#showvisibilitymenu) or programmatically through the [Hidden](/api/v3.0/wisej.web/containers/tabcontrol/wisej.web.tabpage.md#hidden) property.

## Implements

| Name                                                                                   | Description                                                                                                                |
| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| [IBindableComponent](/api/v3.0/wisej.web/data-binding/wisej.web.ibindablecomponent.md) | Bindable components implement this interface.                                                                              |
| [IWisejComponent](/api/v3.0/wisej.core/interfaces/wisej.core.iwisejcomponent.md)       | All wisej components implement this interface.                                                                             |
| [IWisejControl](/api/v3.0/wisej.core/interfaces/wisej.core.iwisejcontrol.md)           | All wisej controls derived from the [Control](/api/v3.0/wisej.web/general/control.md) class must implement this interface. |
| [IWisejSerializable](/api/v3.0/wisej.core/interfaces/wisej.core.iwisejserializable.md) | Allows an object to serialize itself.                                                                                      |


---

# 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/v3.0/wisej.web/containers/tabcontrol.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.
