# ComboBox.ObjectCollection

Namespace: **Wisej.Web**

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

Represents the collection of items in a Wisej.Web.ComboBox control.

{% 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://3858804530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1zeuyneJ2f5i3NKcg6us%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)Count

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

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

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

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

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

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/en-us/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://3858804530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1zeuyneJ2f5i3NKcg6us%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)Add(item)

Adds an item to the list of items for a [ComboBox](https://docs.wisej.com/api/v3.1/wisej.web/lists-and-grids/combobox).

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

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

**Throws:**

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

### ![](https://3858804530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1zeuyneJ2f5i3NKcg6us%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/en-us/dotnet/api/system.object) | Collection of items to add to the list. |

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

Removes all items from the [ComboBox](https://docs.wisej.com/api/v3.1/wisej.web/lists-and-grids/combobox).

### ![](https://3858804530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1zeuyneJ2f5i3NKcg6us%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/en-us/dotnet/api/system.object) | An object representing the item to locate in the collection. |

**Returns:** [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean). true if the item is located within the collection; otherwise, false.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception) *value* is null.

### ![](https://3858804530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1zeuyneJ2f5i3NKcg6us%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/en-us/dotnet/api/system.object) | The object array to copy the collection to.                      |
| **index**       | [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)       | The location in the destination array to copy the collection to. |

### ![](https://3858804530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1zeuyneJ2f5i3NKcg6us%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/en-us/dotnet/api/system.collections.ienumerator). A [IEnumerator](https://docs.microsoft.com/en-us/dotnet/api/system.collections.ienumerator) that represents the item collection.

### ![](https://3858804530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1zeuyneJ2f5i3NKcg6us%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/en-us/dotnet/api/system.object) | An object representing the item to locate in the collection. |

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

**Throws:**

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

### ![](https://3858804530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1zeuyneJ2f5i3NKcg6us%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/en-us/dotnet/api/system.int32)   | The zero-based index location where the item is inserted. |
| **item**  | [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) | An object representing the item to insert.                |

**Throws:**

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

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

Removes the specified item from the [ComboBox](https://docs.wisej.com/api/v3.1/wisej.web/lists-and-grids/combobox).

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

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

Removes an item from the [ComboBox](https://docs.wisej.com/api/v3.1/wisej.web/lists-and-grids/combobox) at the specified index.

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

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/en-us/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://3858804530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1zeuyneJ2f5i3NKcg6us%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)CollectionChanged

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