DataGridView添加一行

           DataGridViewRow dr=new DataGridViewRow ();
                    foreach(DataGridViewColumn c in dataGridView1.Columns)
                    {
                        dr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
                    }
                    dr.Cells[0].Value = 内容;
                    dr.Cells[1].Value = 内容;
                    dr.Cells[2].Value = 内容;
                    dr.Cells[3].Value = 内容;
                    dataGridView1.Rows.Add(dr);

你可能感兴趣的:(DataGridView添加一行)