DataGridViewCellCollection.Add(DataGridViewCell) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
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.