# DataGridViewHeaderCell

Namespace: **Wisej.Web**

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

* [DataGridViewElement](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewelement.md)
  * [DataGridViewCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcell.md)
    * [DataGridViewHeaderCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewheadercell.md)

Contains functionality common to row header cells and column header cells.

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

```csharp
public class DataGridViewHeaderCell : DataGridViewCell
```

{% endtab %}

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

```visual-basic
Public Class DataGridViewHeaderCell
    Inherits DataGridViewCell
```

{% endtab %}
{% endtabs %}

## Constructors

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

Initializes a new instance of [DataGridViewHeaderCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewheadercell.md).

## Properties

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean):

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns a value indicating whether the cell is frozen.

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns a value indicating whether the header cell is read-only.

**Throws:**

* [InvalidOperationException](https://docs.microsoft.com/dotnet/api/system.invalidoperationexception) An operation tries to set this property.

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns a value indicating whether the cell is resizable.

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the cell is selected.

**Throws:**

* [InvalidOperationException](https://docs.microsoft.com/dotnet/api/system.invalidoperationexception) This property is being set.

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

[Type](https://docs.microsoft.com/dotnet/api/system.type): Returns the type of the value stored in the cell.

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns a value indicating whether or not the cell is visible.

## Methods

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

Creates a copy of this cell.

**Returns:** [DataGridViewCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcell.md). The cloned [DataGridViewHeaderCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewheadercell.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) GetInheritedState(rowIndex)

Returns a value indicating the current state of the cell as inherited from the state of its row or column.

| Parameter    | Type                                                        | Description                                                                                                                                                                              |
| ------------ | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **rowIndex** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | The index of the row containing the cell or -1 if the cell is not a row header cell or is not contained within a [DataGridView](/api/wisej.web/lists-and-grids/datagridview.md) control. |

**Returns:** [DataGridViewElementStates](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewelementstates.md). A combination of [DataGridViewElementStates](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewelementstates.md) values representing the current state of the cell.

**Throws:**

* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception) The cell is a row header cell, the cell is not contained within a [DataGridView](/api/wisej.web/lists-and-grids/datagridview.md) control, and *rowIndex* is not -1.- or -The cell is a row header cell, the cell is contained within a [DataGridView](/api/wisej.web/lists-and-grids/datagridview.md) control, and *rowIndex* is outside the valid range of 0 to the number of rows in the control minus 1.- or -The cell is a row header cell and *rowIndex* is not the index of the row containing this cell.
* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception) The cell is a column header cell or the control's [TopLeftHeaderCell](/api/wisej.web/lists-and-grids/datagridview.md#topleftheadercell) and *rowIndex* is not -1.

### ![](/files/lzopMboA31bVq8UIcbT3) GetValue()

Returns the value of the cell.

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). The value contained in the [DataGridViewHeaderCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewheadercell.md).

### ![](/files/lzopMboA31bVq8UIcbT3) SetValue(value)

Sets the value of the cell.

| Parameter | Type                                                          | Description            |
| --------- | ------------------------------------------------------------- | ---------------------- |
| **value** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The cell value to set. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the value has been set; otherwise, false.

## Inherited By

| Name                                                                                                                  | Description                                                                                             |
| --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| [DataGridViewColumnHeaderCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcolumnheadercell.md) | Represents a column header in a [DataGridView](/api/wisej.web/lists-and-grids/datagridview.md) control. |
| [DataGridViewRowHeaderCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewrowheadercell.md)       | Represents a row header of a [DataGridView](/api/wisej.web/lists-and-grids/datagridview.md) control.    |

## Implements

| Name                                                                    | Description                                                                                                     |
| ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| [IUserData](/api/wisej.web/interfaces/wisej.web.iuserdata.md)           | Provides access to the `UserData` and `Tag` properties associated to the component implementing this interface. |
| [ICommandSource](/api/wisej.web/interfaces/wisej.web.icommandsource.md) | Defines an object that can invoke a [Command](/api/wisej.web/interfaces/wisej.web.icommandsource.md#command).   |


---

# 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/lists-and-grids/datagridview/wisej.web.datagridviewheadercell.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.
