Bahasa

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

untuk DataGridViewCell ditambahkan ke koleksi.

Mengembalikan

Posisi untuk menyisipkan elemen baru.

Pengecualian

Baris yang memiliki ini DataGridViewCellCollection sudah menjadi DataGridView milik kontrol.

-atau-

dataGridViewCellsudah 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