# DataGridViewComboBoxCell.ObjectCollection

Namespace: **Wisej.Web**

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

Represents the collection of items in a [DataGridViewComboBoxCell](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcomboboxcell) cell.

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

```csharp
public class ObjectCollection : IList, ICollection, IEnumerable
```

{% endtab %}

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

```visual-basic
Public Class ObjectCollection
    Inherits IList
    Implements ICollection, IEnumerable
```

{% endtab %}
{% endtabs %}

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

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns the number of items in the collection.

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns a value indicating whether this collection can be modified.

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

[Object](https://docs.microsoft.com/dotnet/api/system.object): Retrieves the item at the specified index within the collection.

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)\
  The index was less than zero; or the index was greater of equal to the count of items in the collection.

## 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) Add(item)

Adds an item to the list of items for a [DataGridViewComboBoxColumn](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcomboboxcolumn).

| Parameter | Type                                                          | Description                                               |
| --------- | ------------------------------------------------------------- | --------------------------------------------------------- |
| **item**  | [Object](https://docs.microsoft.com/dotnet/api/system.object) | An object representing the item to add to the collection. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The zero-based index of the item in the collection.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  The *item* parameter was null.

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

Adds a collection of items to the list.

| Parameter | Type                                                              | Description                             |
| --------- | ----------------------------------------------------------------- | --------------------------------------- |
| **items** | [Object\[\]](https://docs.microsoft.com/dotnet/api/system.object) | Collection of items to add to the list. |

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

Removes all items from the [DataGridViewComboBoxColumn](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcomboboxcolumn).

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

Determines if the specified item is located within the collection.

| Parameter | Type                                                          | Description                                                  |
| --------- | ------------------------------------------------------------- | ------------------------------------------------------------ |
| **value** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | An object representing the item to locate in the collection. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the item is located within the collection; otherwise, 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) CopyTo(destination, index)

Copies the entire collection into an existing array of objects at a specified location within the array.

| Parameter       | Type                                                              | Description                                                      |
| --------------- | ----------------------------------------------------------------- | ---------------------------------------------------------------- |
| **destination** | [Object\[\]](https://docs.microsoft.com/dotnet/api/system.object) | The object array to copy the collection to.                      |
| **index**       | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)       | The location in the destination array to copy the collection to. |

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

Returns an enumerator that can be used to iterate through the item collection.

**Returns:** [IEnumerator](https://docs.microsoft.com/dotnet/api/system.collections.ienumerator). A [IEnumerator](https://docs.microsoft.com/dotnet/api/system.collections.ienumerator) that represents the item collection.

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

Retrieves the index within the collection of the specified item.

| Parameter | Type                                                          | Description                                                  |
| --------- | ------------------------------------------------------------- | ------------------------------------------------------------ |
| **value** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | An object representing the item to locate in the collection. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The zero-based index where the item is located within the collection; otherwise, -1.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  The *value* parameter was null.

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

Inserts an item into the collection at the specified index.

| Parameter | Type                                                          | Description                                               |
| --------- | ------------------------------------------------------------- | --------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The zero-based index location where the item is inserted. |
| **item**  | [Object](https://docs.microsoft.com/dotnet/api/system.object) | An object representing the item to insert.                |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  The *item* was null.
* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)\
  The *index* was less than zero; or the *index* was greater than the count of items in the collection.

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

Fires the [CollectionChanged](#collectionchanged) event.

| Parameter   | Type                                                                                                         | Description                                                                                                                                                           |
| ----------- | ------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **action**  | [CollectionChangeAction](https://docs.microsoft.com/dotnet/api/system.componentmodel.collectionchangeaction) | One of [CollectionChangeAction](https://docs.microsoft.com/dotnet/api/system.componentmodel.collectionchangeaction) indicating the reason the collection has changed. |
| **element** | [Object](https://docs.microsoft.com/dotnet/api/system.object)                                                | The element that was added or removed from the collection, or null.                                                                                                   |

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

Removes the specified item from the [DataGridViewComboBoxColumn](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcomboboxcolumn).

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

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

Removes an item from the [DataGridViewComboBoxColumn](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcomboboxcolumn) at the specified index.

| Parameter | Type                                                        | Description                      |
| --------- | ----------------------------------------------------------- | -------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | The index of the item to remove. |

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)\
  The *index* parameter was less than zero, or the *index* parameter was greater than or equal to the count of items in the collection.

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

[CollectionChangeEventHandler](https://docs.microsoft.com/dotnet/api/system.componentmodel.collectionchangeeventhandler) Fired when the collection changes.
