DataGridViewCellCollection.AddRange(DataGridViewCell[]) 方法

定義

將儲存格的陣列加入集合中。

public:
 virtual void AddRange(... cli::array <System::Windows::Forms::DataGridViewCell ^> ^ dataGridViewCells);
public virtual void AddRange (params System.Windows.Forms.DataGridViewCell[] dataGridViewCells);
abstract member AddRange : System.Windows.Forms.DataGridViewCell[] -> unit
override this.AddRange : System.Windows.Forms.DataGridViewCell[] -> unit
Public Overridable Sub AddRange (ParamArray dataGridViewCells As DataGridViewCell())

參數

dataGridViewCells
DataGridViewCell[]

要加入至集合的 DataGridViewCell 物件陣列。

例外狀況

dataGridViewCellsnull

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

-或- dataGridViewCells 中至少有一個值為 null

-或- dataGridViewCells 中至少有一個儲存格已屬於 DataGridViewRow

-或- dataGridViewCells 中至少有兩個值是同一 DataGridViewCell 的參考。

備註

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

適用於

另請參閱