zhoujian315

在winform中,有时候我们希望动态给dataGridView添加行

winform添加行是很简单的,看下面代码

 int index=this.dataGridView1.Rows.Add(); //添加行的索引
                this.dataGridView1.Rows[index].Cells[0].Value = "1"; //第0列的值
                this.dataGridView1.Rows[index].Cells[1].Value = "2"; //第一列的值

 通过上面就可以动态给dataGridView添加行了;

分类:

技术点:

相关文章: