1. 在行尾添加新的一行数据
DataGridViewRow row = new DataGridViewRow();
row.CreateCells(dataGridView1);
row.Cells[0].Value = 23;
row.Cells[1].Value = 45;
this.dataGridView1.Rows.Add(row);
2. 修改某一行的数据
int iRowIndex = n;
this.dataGridView1["Column1", iRowIndex].Value = "1";
this.dataGridView1["Column2", iRowIndex].Value = "张三";
this.dataGridView1["Column3", iRowIndex].Value = "软件部";
3. 在行首插入一天记录,不会覆盖原来数据,也可在任意位置插入
DataGridViewRow row = new DataGridViewRow();
row.CreateCells(dataGridView1);
row.Cells[0].Value = "hh";
row.Cells[1].Value = "yy";
this.dataGridView1.Rows.Insert(0, row);