DataGridViewComboBoxCell.ObjectCollection.Insert(Int32, Object) Method

Definition

Inserts an item into the collection at the specified index.

public:
 virtual void Insert(int index, System::Object ^ item);
public void Insert (int index, object item);
public void Insert (int index, object? item);
abstract member Insert : int * obj -> unit
override this.Insert : int * obj -> unit
Public Sub Insert (index As Integer, item As Object)

Parameters

index
Int32

The zero-based index at which to place item within an unsorted DataGridViewComboBoxCell.

item
Object

An object representing the item to insert.

Implements

Exceptions

item is null.

index is less than 0 or greater than the number of items in the collection.

The cell's DataSource property value is not null.

The cell is in a shared row.

Remarks

If Sorted is false, then the index value represents the position at which the item value is inserted. If Sorted is true, then index is ignored and item is placed in the collection in a position determined by the sorting order.

Applies to

See also