Transfer Data From One Data Gridview to Another using Checkbox Column

  1. int i = 0;  
  2. foreach (DataGridViewRow  row in  this.dataGridView1.Rows)  
  3. {  
  4.    //ck means CheckBox Column Name in Datagridview1  
  5.    if (Convert.ToBoolean(row.Cells["ck"].Value) == true)  
  6.    {  
  7.       DataGridViewRow r = new DataGridViewRow();  
  8.       dataGridView2.Rows.Add(r);  
  9.       dataGridView2.Rows[i].Cells[0].Value = row.Cells[0].Value.ToString();  
  10.       dataGridView2.Rows[i].Cells[1].Value = row.Cells[1].Value.ToString();  
  11.       dataGridView2.Rows[i].Cells[2].Value = row.Cells[2].Value.ToString();  
  12.       i++;  
  13.    }  
  14. }