# DataGridViewComboBoxCell

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)
    * [DataGridViewComboBoxCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcomboboxcell.md)

Displays an editable [ComboBox](/api/wisej.web/lists-and-grids/combobox.md) control in a [DataGridViewCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcell.md) cell when in edit mode.

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

```csharp
public class DataGridViewComboBoxCell : DataGridViewCell
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

## Constructors

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

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

## Properties

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

[AutoCompleteMode](/api/wisej.web/enumerations/wisej.web.autocompletemode.md): Returns or sets how automatic completion works for the [DataGridViewComboBoxColumn](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcomboboxcolumn.md). (Default: `None`)

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

[CharacterCasing](/api/wisej.web/editors/wisej.web.charactercasing.md): Returns or sets whether the cell editor modifies the case of characters as they are typed. (Default: `Normal`)

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

[Object](https://docs.microsoft.com/dotnet/api/system.object): Returns or sets the data source that contains the possible selections shown in the drop-down list.

**Throws:**

* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception)\
  The specified value when setting this property is not null and is not of type [IList](https://docs.microsoft.com/dotnet/api/system.collections.ilist) nor [IListSource](https://docs.microsoft.com/dotnet/api/system.componentmodel.ilistsource).

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the name of the property or column from which to retrieve the text to display in the combo box cell. (Default: `""`)

**Throws:**

* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception)\
  The [DataSource](#datasource) property is not null and the specified value when setting this property is not null or [Empty](https://docs.microsoft.com/dotnet/api/system.string.empty) and does not name a valid property or column in the data source.

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

[ComboBoxStyle](/api/wisej.web/enumerations/wisej.web.comboboxstyle.md): Returns or sets the style of the combo box. (Default: `DropDown`)

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

[Type](https://docs.microsoft.com/dotnet/api/system.type): Returns the type of the cell's hosted editing control.

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the name of the property or column from which to get the icon to use in the drop-down list. (Default: `""`)

**Throws:**

* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception)\
  The [DataSource](#datasource) property is not null and the specified value when setting this property is not null or [Empty](https://docs.microsoft.com/dotnet/api/system.string.empty) and does not name a valid property or column in the data source.

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether items are selected incrementally as the user types within a timeout of 1 second. (Default: `True`)

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

[ObjectCollection](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcomboboxcell.objectcollection.md): Returns the collection of the items contained in this [DataGridViewComboBoxCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcomboboxcell.md).

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Enables or disables lazy loading mode for the [ComboBox](/api/wisej.web/lists-and-grids/combobox.md) cell editor control. (Default: `False`)

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

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns or sets the maximum number of characters that can be entered into the editable part of the combo box control. (Default: `0`)

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)\
  The value is less than 0.

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets if the items in the combo box editor are automatically sorted. (Default: `False`)

**Throws:**

* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception)\
  An attempt was made to sort a cell that is attached to a data source.

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

[ComponentToolCollection](/api/wisej.web/editors/wisej.web.componenttoolcollection.md): Returns the instance of [ComponentToolCollection](/api/wisej.web/editors/wisej.web.componenttoolcollection.md) associated with this cell.

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the name of the property or column from which to get the value that correspond to the selections in the drop-down list. (Default: `""`)

**Throws:**

* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception)\
  The [DataSource](#datasource) property is not null and the specified value when setting this property is not null or [Empty](https://docs.microsoft.com/dotnet/api/system.string.empty) and does not name a valid property or column in the data source.

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

[Type](https://docs.microsoft.com/dotnet/api/system.type): Returns or sets the data type of the values in the cell.

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Enables or disables virtual scrolling mode for the [ComboBox](/api/wisej.web/lists-and-grids/combobox.md) cell editor control. (Default: `False`)

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the text to show when the control is empty.

## Methods

### ![](/files/lzopMboA31bVq8UIcbT3) GetFormattedValue(value, cellStyle, valueTypeConverter, formattedTypeConverter)

Returns the value of the cell formatted to be displayed on the client.

| Parameter                                      | Type                                                                                                    | Description                                                                                                                                                                                                      |
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **value**                                      | [Object](https://docs.microsoft.com/dotnet/api/system.object)                                           | The value to be formatted.                                                                                                                                                                                       |
| **cellStyle** ![](/files/RboPbVYgUdZ2I6eDoFQj) | [DataGridViewCellStyle](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcellstyle.md) | The [DataGridViewCellStyle](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcellstyle.md) in for the cell.                                                                                     |
| **valueTypeConverter**                         | [TypeConverter](https://docs.microsoft.com/dotnet/api/system.componentmodel.typeconverter)              | A [TypeConverter](https://docs.microsoft.com/dotnet/api/system.componentmodel.typeconverter) providing custom conversion from the formatted type to the value type, or null if no custom conversion is required. |
| **formattedTypeConverter**                     | [TypeConverter](https://docs.microsoft.com/dotnet/api/system.componentmodel.typeconverter)              | A [TypeConverter](https://docs.microsoft.com/dotnet/api/system.componentmodel.typeconverter) providing custom conversion from the value type to the formatted type, or null if no custom conversion is required. |

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). The value of the cell or null if the cell does not belong to a [DataGridView](/api/wisej.web/lists-and-grids/datagridview.md) control.

**Throws:**

* [Exception](https://docs.microsoft.com/dotnet/api/system.exception)\
  Formatting failed and there is no handler for the [DataError](/api/wisej.web/lists-and-grids/datagridview.md#dataerror) event of the [DataGridView](/api/wisej.web/lists-and-grids/datagridview.md) or the handler set the [ThrowException](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewdataerroreventargs.md#throwexception) property to true.

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

Called when the element is associated with a different [DataGridView](/api/wisej.web/lists-and-grids/datagridview.md).

### ![](/files/lzopMboA31bVq8UIcbT3) OnItemsCollectionChanged(e)

Fires the CollectionChanged event.

| Parameter | Type                                                                | Description |
| --------- | ------------------------------------------------------------------- | ----------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) |             |

### ![](/files/hsR4ok3152WyAf8J2C1u) ParseFormattedValue(value, cellStyle, formattedTypeConverter, valueTypeConverter)

Converts a value to the actual cell value.

| Parameter                  | Type                                                                                                    | Description                                                                                                                                                    |
| -------------------------- | ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **value**                  | [Object](https://docs.microsoft.com/dotnet/api/system.object)                                           | The display value of the cell.                                                                                                                                 |
| **cellStyle**              | [DataGridViewCellStyle](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcellstyle.md) | The [DataGridViewCellStyle](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcellstyle.md) in effect for the cell.                            |
| **formattedTypeConverter** | [TypeConverter](https://docs.microsoft.com/dotnet/api/system.componentmodel.typeconverter)              | A [TypeConverter](https://docs.microsoft.com/dotnet/api/system.componentmodel.typeconverter) for the display value type, or null to use the default converter. |
| **valueTypeConverter**     | [TypeConverter](https://docs.microsoft.com/dotnet/api/system.componentmodel.typeconverter)              | A [TypeConverter](https://docs.microsoft.com/dotnet/api/system.componentmodel.typeconverter) for the cell value type, or null to use the default converter.    |

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). The cell value.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)*cellStyle* is null.
* [FormatException](https://docs.microsoft.com/dotnet/api/system.formatexception)\
  The [FormattedValueType](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcell.md#formattedvaluetype) property value is null or the [ValueType](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcell.md#valuetype) property value is null or *value* cannot be converted.
* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception)*value* is null or the type of *value* does not match the type indicated by the [FormattedValueType](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcell.md#formattedvaluetype) property.

## Events

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

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the collection changes.

## 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.datagridviewcomboboxcell.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.
