Edit

Share via


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

item
Object

An object representing the item to insert.

Implements

Exceptions

The item was null.

The index was less than zero.

-or-

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

Remarks

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.

Applies to

See also