ComboBox.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 location where the item is inserted.

item
Type: System.Object

An object representing the item to insert.

Exception Condition
ArgumentNullException

The item was null.

ArgumentOutOfRangeException

The index was less than zero.

-or-

The index was greater than the count of items in the collection.

If the Sorted property of the ComboBox is true, the index parameter is ignored. When an object is added to the collection, the ComboBox calls the object's ToString method is to obtain the string to display in the list.

.NET Framework
Available since 1.1
Return to top
Show: