DataGridViewCellCollection.Insert(Int32, DataGridViewCell) 方法

定義

將儲存格插入指定索引上的集合中。

public:
 virtual void Insert(int index, System::Windows::Forms::DataGridViewCell ^ dataGridViewCell);
public virtual void Insert (int index, System.Windows.Forms.DataGridViewCell dataGridViewCell);
abstract member Insert : int * System.Windows.Forms.DataGridViewCell -> unit
override this.Insert : int * System.Windows.Forms.DataGridViewCell -> unit
Public Overridable Sub Insert (index As Integer, dataGridViewCell As DataGridViewCell)

參數

index
Int32

要放置 dataGridViewCell 處之以零起始的索引。

dataGridViewCell
DataGridViewCell

要插入的 DataGridViewCell

例外狀況

擁有這個 DataGridViewCellCollection 的資料列已經屬於 DataGridView 控制項。

-或-

dataGridViewCell 已經屬於 DataGridViewRow

備註

在將包含的資料列加入控制項 DataGridView 之前,請使用這個方法來改變集合。 將資料列加入控制項之後,它所包含的儲存格數目一律符合 控制項中的資料行數目,因此此方法不再有用。

適用於

另請參閱