DataGridViewComboBoxCell.ObjectCollection.Insert Method (Int32, Object)

 

Inserts an item into the collection at the specified index.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public void Insert(
	int index,
	object item
)

Parameters

index
Type: System.Int32

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

item
Type: System.Object

An object representing the item to insert.

Exception Condition
ArgumentNullException

item is null.

ArgumentOutOfRangeException

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

ArgumentException

The cell's DataSource property value is not null.

InvalidOperationException

The cell is in a shared row.

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.

.NET Framework
Available since 2.0
Return to top
Show: