
View Code
1 //新建一个数据行 2 DataGridViewRow row=new DataGridViewRow(); 3 4 //复制单元格 5 row.CreateCells(dgv); 6 7 //添加数据 8 row.Cells[0].Value="数据1"; 9 row.Cells[1].Value="数据2"; 10 。。。 11 12 //将该行添加到界面中 13 this.dgv.Rows.Add(row);
本文介绍如何使用C#在DataGridView控件中创建并添加新的数据行。通过实例代码演示了从新建数据行开始,到复制单元格、填充数据,直至最终将数据行添加到DataGridView界面的全过程。

View Code
1 //新建一个数据行 2 DataGridViewRow row=new DataGridViewRow(); 3 4 //复制单元格 5 row.CreateCells(dgv); 6 7 //添加数据 8 row.Cells[0].Value="数据1"; 9 row.Cells[1].Value="数据2"; 10 。。。 11 12 //将该行添加到界面中 13 this.dgv.Rows.Add(row);
转载于:https://www.cnblogs.com/shuyajun/archive/2012/07/12/2588170.html
1288

被折叠的 条评论
为什么被折叠?