DataGridViewComboBoxCell.ObjectCollection.Insert(Int32, Object) DataGridViewComboBoxCell.ObjectCollection.Insert(Int32, Object) DataGridViewComboBoxCell.ObjectCollection.Insert(Int32, Object) DataGridViewComboBoxCell.ObjectCollection.Insert(Int32, Object) Method

定義

將項目插入至索引中的指定索引處。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);
abstract member Insert : int * obj -> unit
override this.Insert : int * obj -> unit
Public Sub Insert (index As Integer, item As Object)

參數

index
Int32 Int32 Int32 Int32

在未排序的 DataGridViewComboBoxCell 中,要放置 item 處之以零起始的索引。The zero-based index at which to place item within an unsorted DataGridViewComboBoxCell.

item
Object Object Object Object

表示要插入之項目的物件。An object representing the item to insert.

實作

例外狀況

index 小於 0 或大於集合中的項目數。index is less than 0 or greater than the number of items in the collection.

儲存格的 DataSource 屬性值不為 nullThe cell's DataSource property value is not null.

儲存格位於共用資料列中。The cell is in a shared row.

備註

如果Sortedfalse,則index值代表的位置item會插入值。If Sorted is false, then the index value represents the position at which the item value is inserted. 如果Sortedtrue,然後index會忽略和item放置在集合中的排序順序所決定的位置。If Sorted is true, then index is ignored and item is placed in the collection in a position determined by the sorting order.

適用於

另請參閱