DataGridViewCellCollection.Add(DataGridViewCell) Metoda

Definicja

Dodaje komórkę do kolekcji.

public:
 virtual int Add(System::Windows::Forms::DataGridViewCell ^ dataGridViewCell);
public virtual int Add (System.Windows.Forms.DataGridViewCell dataGridViewCell);
abstract member Add : System.Windows.Forms.DataGridViewCell -> int
override this.Add : System.Windows.Forms.DataGridViewCell -> int
Public Overridable Function Add (dataGridViewCell As DataGridViewCell) As Integer

Parametry

dataGridViewCell
DataGridViewCell

A DataGridViewCell do dodania do kolekcji.

Zwraca

Int32

Położenie, w którym ma zostać wstawiony nowy element.

Wyjątki

Wiersz, który jest właścicielem tej DataGridViewCellCollection kontrolki, należy już do kontrolki DataGridView .

-lub- dataGridViewCell element należy już do klasy DataGridViewRow.

Uwagi

Użyj tej metody, aby wypełnić DataGridViewRow element komórkami przed dodaniem wiersza do kontrolki DataGridView . Po dodaniu wiersza do kontrolki liczba komórek, które zawiera, zawsze odpowiada liczbie kolumn w kontrolce, więc ta metoda nie jest już przydatna.

Dotyczy

Zobacz też