日期:2014-05-16 浏览次数:21075 次
public static DataGridViewRow CloneRow(DataGridViewRow row)
{
DataGridViewRow clonedRow = (DataGridViewRow)row.Clone();
for (int i = 0; i < row.Cells.Count; i++)
{
clonedRow.Cells[i].Value = row.Cells[i].Value;
}
return clonedRow;
}
private void button1_Click(object sender, EventArgs e)
{
DataGridViewRow row= CloneRow(dataGridView1.Rows[0]);
Console.WriteLine(dataGridView1.Rows[0].Cells["abc"].Value.ToString());
Console.WriteLine(row.Cells["abc"].Value.ToString());
}
Console.WriteLine(row.Cells[0].Value.ToString());