title: No row can be added to a DataGridView control that does not have columns. Columns must be added first
body: <p>I want to transfer data in one row from <code>datagridview1</code> to <code>datagridview2</code>, but when I run this code it show like this</p>
  
  <blockquote>
    <p>(Additional information: No row can be added to a DataGridView control
    that does not have columns. Columns must be added first).</p>
  </blockquote>
  
  <pre><code>  foreach (DataGridViewRow dgvr in dataGridView1.SelectedRows)
          {
              DataGridViewRow r = dgvr.Clone() as DataGridViewRow;
              foreach (DataGridViewCell cell in dgvr.Cells)
              {
                  r.Cells[cell.ColumnIndex].Value = cell.Value;
              }
              dataGridView1.Rows.Remove(dgvr);
              dataGridView2.Rows.Add(r);
          }
  </code></pre>