Share via


DataGridViewRow.CreateCells 方法

定義

重設資料列中的儲存格。

多載

CreateCells(DataGridView, Object[])

清除現有儲存格並設定其範本和值。

CreateCells(DataGridView)

清除現有儲存格,並根據所提供的 DataGridView 樣板,設定其樣板。

CreateCells(DataGridView, Object[])

清除現有儲存格並設定其範本和值。

public:
 void CreateCells(System::Windows::Forms::DataGridView ^ dataGridView, ... cli::array <System::Object ^> ^ values);
public void CreateCells (System.Windows.Forms.DataGridView dataGridView, params object[] values);
member this.CreateCells : System.Windows.Forms.DataGridView * obj[] -> unit
Public Sub CreateCells (dataGridView As DataGridView, ParamArray values As Object())

參數

dataGridView
DataGridView

DataGridView,做為儲存格樣式的樣板。

values
Object[]

初始化重設儲存格的物件陣列。

例外狀況

兩個參數都是 null

加入本來就屬於 DataGridView 的資料列。

-或- 未加入儲存格樣板的資料行。

備註

這個方法會清除資料列的 , DataGridViewCellCollection 並使用 參數之每個資料行的 dataGridView 屬性重新初始化 CellTemplate 它。 因此,資料列會採用 參數 dataGridView 中資料列的外觀和行為。

如果陣列中的元素數目超過要初始化的 values 儲存格,則會忽略額外的元素。 如果元素少於必要專案,其餘不相符的資料格會保留其預設的初始值。

另請參閱

適用於

CreateCells(DataGridView)

清除現有儲存格,並根據所提供的 DataGridView 樣板,設定其樣板。

public:
 void CreateCells(System::Windows::Forms::DataGridView ^ dataGridView);
public void CreateCells (System.Windows.Forms.DataGridView dataGridView);
member this.CreateCells : System.Windows.Forms.DataGridView -> unit
Public Sub CreateCells (dataGridView As DataGridView)

參數

dataGridView
DataGridView

DataGridView,做為儲存格樣式的樣板。

例外狀況

dataGridViewnull

加入本來就屬於 DataGridView 的資料列。

-或- 未加入儲存格樣板的資料行。

備註

這個方法會清除資料列的 , DataGridViewCellCollection 並使用 參數之每個資料行的 dataGridView 屬性重新初始化 CellTemplate 它。 因此,資料列會採用 參數 dataGridView 中資料列的外觀和行為。

另請參閱

適用於