Edit

Bagikan melalui


DataGridViewRow.CreateCells Method

Definition

Resets the cells in the row.

Overloads

CreateCells(DataGridView, Object[])

Clears the existing cells and sets their template and values.

CreateCells(DataGridView)

Clears the existing cells and sets their template according to the supplied DataGridView template.

CreateCells(DataGridView, Object[])

Clears the existing cells and sets their template and values.

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())

Parameters

dataGridView
DataGridView

A DataGridView that acts as a template for cell styles.

values
Object[]

An array of objects that initialize the reset cells.

Exceptions

Either of the parameters is null.

A row that already belongs to the DataGridView was added.

-or-

A column that has no cell template was added.

Remarks

This method clears the row's DataGridViewCellCollection and reinitializes it with the CellTemplate property of each column of the dataGridView parameter. As a result, the row adopts the appearance and behavior of a row from the dataGridView parameter.

If there are more elements in the values array than cells to be initialized, the extra elements will be ignored. If there are fewer elements than required, the remaining unmatched cells will retain their default initial values.

See also

Applies to

CreateCells(DataGridView)

Clears the existing cells and sets their template according to the supplied DataGridView template.

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)

Parameters

dataGridView
DataGridView

A DataGridView that acts as a template for cell styles.

Exceptions

dataGridView is null.

A row that already belongs to the DataGridView was added.

-or-

A column that has no cell template was added.

Remarks

This method clears the row's DataGridViewCellCollection and reinitializes it with the CellTemplate property of each column of the dataGridView parameter. As a result, the row adopts the appearance and behavior of a row from the dataGridView parameter.

See also

Applies to