【发布时间】:2011-09-14 05:47:07
【问题描述】:
所以基本上我有 2 个DataGridView,我需要将行从一个复制到另一个。
到目前为止我已经尝试过:
DataGridViewRowCollection tmpRowCollection = DataGridView1.Rows;
DataGridViewRow[] tmpRowArray = new DataGridViewRow[tmpRowCollection.Count];
tmpRowCollection.CopyTo(tmpRowArray, 0);
DataGridView2.Rows.AddRange((DataGridViewRow[]) tmpRowArray));
但它一直在说
"Row provided already belongs to a DataGridView control."
那么复制行内容的最佳方法是什么(DataGridView 具有相同的列)?
【问题讨论】:
标签: c# datagridview clone