if (dgvData.SelectedRows.Count > 0)
{
DataTable orgData = (DataTable)this.dgvData.DataSource;
DataTable newData = orgData.Clone();
for (int r = 0; r < dgvData.SelectedRows.Count; r++)
{
DataGridViewRow selectedRow = this.dgvData.SelectedRows[r];
DataRow copyRow = newData.NewRow();
for (int j = 0; j < this.dgvData.Columns.Count; j++)
{
copyRow[j] = selectedRow.Cells[j].Value;
}
newData.Rows.Add(copyRow);
}
}
{
DataTable orgData = (DataTable)this.dgvData.DataSource;
DataTable newData = orgData.Clone();
for (int r = 0; r < dgvData.SelectedRows.Count; r++)
{
DataGridViewRow selectedRow = this.dgvData.SelectedRows[r];
DataRow copyRow = newData.NewRow();
for (int j = 0; j < this.dgvData.Columns.Count; j++)
{
copyRow[j] = selectedRow.Cells[j].Value;
}
newData.Rows.Add(copyRow);
}
}