# DataGridViewComboBoxCell.ObjectCollection

Namespace: **Wisej.Web**

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

Represents the collection of items in a [DataGridViewComboBoxCell](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcomboboxcell.md) 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

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

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

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

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

### ![](/files/hsR4ok3152WyAf8J2C1u) 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

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(item)

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

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

### ![](/files/hsR4ok3152WyAf8J2C1u) 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. |

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

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

### ![](/files/hsR4ok3152WyAf8J2C1u) 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.

### ![](/files/hsR4ok3152WyAf8J2C1u) 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. |

### ![](/files/hsR4ok3152WyAf8J2C1u) 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.

### ![](/files/hsR4ok3152WyAf8J2C1u) 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.

### ![](/files/hsR4ok3152WyAf8J2C1u) 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.

### ![](/files/lzopMboA31bVq8UIcbT3) 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.                                                                                                   |

### ![](/files/hsR4ok3152WyAf8J2C1u) Remove(value)

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

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

### ![](/files/hsR4ok3152WyAf8J2C1u) RemoveAt(index)

Removes an item from the [DataGridViewComboBoxColumn](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcomboboxcolumn.md) 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

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

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


---

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