DataGridViewCellCollection.Add(DataGridViewCell) Metod

Definition

Lägger till en cell i samlingen.

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

Parametrar

dataGridViewCell
DataGridViewCell

A DataGridViewCell som ska läggas till i samlingen.

Returer

Den position där det nya elementet ska infogas.

Undantag

Raden som äger detta DataGridViewCellCollection tillhör redan en DataGridView kontroll.

-eller-

dataGridViewCell tillhör redan en DataGridViewRow.

Kommentarer

Använd den här metoden för att fylla i en DataGridViewRow med celler innan du lägger till raden i en DataGridView kontroll. När du lägger till raden i en kontroll matchar antalet celler som den innehåller alltid antalet kolumner i kontrollen, så den här metoden är inte längre användbar.

Gäller för

Se även