# DataGridViewComboBoxCell

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

Displays an editable [ComboBox](https://docs.wisej.com/api/wisej.web/lists-and-grids/combobox) control in a [DataGridViewCell](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcell) 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

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

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

## 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) AutoCompleteMode

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[ComponentToolCollection](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttoolcollection): Returns the instance of [ComponentToolCollection](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttoolcollection) associated with this 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) 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.

### ![](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 or sets the data type of the values 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) VirtualScroll

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

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

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

## Methods

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) 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** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-912a3bc068ac1c69bcaa58145e4ee468ccd8a555%2Fbadge-byref.svg?alt=media) | [DataGridViewCellStyle](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcellstyle) | The [DataGridViewCellStyle](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcellstyle) 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](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview) control.

**Throws:**

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

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

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

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

Fires the CollectionChanged event.

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

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

## Events

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

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

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