title: How to transfer selected rows from one datagridview to another?
body: <p>I try to transfer selected rows from one datagridview to another. I used combobox textchange event to load selected data to datagrid. So that transfer code need to do <code>dataGridView1.AllowUserToAddRows = false;</code> for both <code>dataGridView</code>s. But due to use combobox textchange event I can't disable adding new rows. How to solve this? I use following code to transfer values:           </p>
  
  <pre><code>private void btnaddtoanother_Click(object sender, EventArgs e)
      {
          for (int i = 0; i &lt;= dataGridView2.Rows.Count - 1; i++)
          {
              bool rowAlreadyExist = false;
              bool checkedCell = (bool)dataGridView2.Rows[i].Cells[0].Value;
              if (checkedCell == true)
              {
                  DataGridViewRow row = dataGridView2.Rows[i];
                  if (dataGridView1.Rows.Count != 0)
                  {
                      for (int j = 0; j &lt;= dataGridView1.Rows.Count - 1; j++)
                      {
                          if (row.Cells[0].Value.ToString() == dataGridView1.Rows[j].Cells[0].Value.ToString())
                          {
                              rowAlreadyExist = true;
                              break;
                          }
                      }
                      if (rowAlreadyExist == false)
                      {
                          dataGridView2.Rows.Add(row.Cells[0].Value.ToString());
                          dataGridView2.Rows.Add(row.Cells[1].Value.ToString());
                          dataGridView2.Rows.Add(row.Cells[3].Value.ToString());
                      }
                  }
                  else
                  {
                      dataGridView2.Rows.Add(row.Cells[0].Value.ToString());
                      dataGridView2.Rows.Add(row.Cells[1].Value.ToString());
                      dataGridView2.Rows.Add(row.Cells[3].Value.ToString());
                  }
              }
          }
      }
  </code></pre>