DataGridViewCellCollection.Add(DataGridViewCell) Méthode

Définition

Ajoute une cellule à la collection.

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

Paramètres

dataGridViewCell
DataGridViewCell

À DataGridViewCell ajouter à la collection.

Retours

Position dans laquelle insérer le nouvel élément.

Exceptions

Ligne qui possède cette DataGridViewCellCollection propriété appartient déjà à un DataGridView contrôle.

-ou-

dataGridViewCell appartient déjà à un DataGridViewRow.

Remarques

Utilisez cette méthode pour remplir une DataGridViewRow cellule avant d’ajouter la ligne à un DataGridView contrôle. Une fois que vous avez ajouté la ligne à un contrôle, le nombre de cellules qu’il contient correspond toujours au nombre de colonnes dans le contrôle. Cette méthode n’est donc plus utile.

S’applique à

Voir aussi