首页 > 代码库 > DataGridView 添加行

DataGridView 添加行

说明:

(1)dgvGoods 是DataGridView名 

(2)index 是最大行索引



DataGridViewRow row = new DataGridViewRow();

int index = dgvGoods.Rows.Add(row);

dgvGoods.Rows[index].Cells["列名1"].Value = http://www.mamicode.com/值1;

dgvGoods.Rows[index].Cells["列名2"].Value = http://www.mamicode.com/值2;

、、、

DataGridView 添加行