Share via


DataGridViewCellCollection.Add(DataGridViewCell) Metode

Definisi

Menambahkan sel ke koleksi.

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

Parameter

dataGridViewCell
DataGridViewCell

A DataGridViewCell untuk ditambahkan ke koleksi.

Mengembalikan

Posisi untuk menyisipkan elemen baru.

Pengecualian

Baris yang memiliki ini DataGridViewCellCollection sudah termasuk DataGridView dalam kontrol.

-atau-

dataGridViewCellsudah menjadi milik .DataGridViewRow

Keterangan

Gunakan metode ini untuk mengisi DataGridViewRow dengan sel sebelum Anda menambahkan baris ke DataGridView kontrol. Setelah Anda menambahkan baris ke kontrol, jumlah sel yang dikandungnya selalu cocok dengan jumlah kolom dalam kontrol, sehingga metode ini tidak lagi berguna.

Berlaku untuk

Lihat juga