# DataGridViewHeaderCell

Namespace: **Wisej.Web**

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

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

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) DataGridViewHeaderCell()

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

## Properties

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Displayed

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Frozen

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Resizable

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ValueType

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Visible

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

## Methods

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Clone()

Creates a copy of this cell.

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview) control. |

**Returns:** [DataGridViewElementStates](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewelementstates). A combination of [DataGridViewElementStates](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewelementstates) 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](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview) control, and *rowIndex* is not -1.- or -The cell is a row header cell, the cell is contained within a [DataGridView](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview) 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](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview/..#topleftheadercell) and *rowIndex* is not -1.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) GetValue()

Returns the value of the cell.

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) 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](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcolumnheadercell) | Represents a column header in a [DataGridView](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview) control. |
| [DataGridViewRowHeaderCell](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewrowheadercell)       | Represents a row header of a [DataGridView](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview) control.    |

## Implements

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