Język

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

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

Wyjątki

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

— lub —

dataGridViewCell element należy już do klasy DataGridViewRow.

Uwagi

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

Dotyczy

Zobacz też