DataGridViewCellCollection.Insert(Int32, DataGridViewCell) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在指定的索引處插入一個儲存格。
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
例外狀況
擁有這筆的 DataGridViewCellCollection 那一列已經屬於控制 DataGridView 組。
-或-
dataGridViewCell 已經屬於 DataGridViewRow。
備註
在將包含的列加入 DataGridView 控制項前,先用此方法修改集合。 一旦你將該列加入控制項,所包含的儲存格數總是與控制項中的欄位數相符,因此此方法不再有用。