title: How to remove duplicate row from datagridview in c#?
body: <p>this is my datagrid<img src="https://i.stack.imgur.com/8M4fc.png" alt="datagrid with duplicate value"></p>
  
  <p>i tried the following code for removing the duplicate row in datagridview</p>
  
  <pre><code>public static DataTable items = new DataTable();
  items.Columns.Add("Backsn");
  items.Columns.Add("Oprn Name");
  for (int i = 0; i &lt; dataGridView1.Rows.Count;i++ )
    {
   DataRow rw = items.NewRow();
   rw[0] = dataGridView1.Rows[i].Cells[2].Value.ToString();
   rw[1] = dataGridView1.Rows[i].Cells[8].Value.ToString();
   items.Rows.Add(rw);
  }
  dataGridView2.DataSource = items;
  for (int i = 0; i &lt; dataGridView2.Rows.Count; i++)
          {
              int k = 0;
              for (int j = 0; j &lt; dataGridView2.Rows.Count; j++)
              {
  
                  if (dataGridView2.Rows[i].Cells[0].Value == dataGridView2.Rows[j].Cells[0].Value &amp;&amp; dataGridView2.Rows[i].Cells[1].Value == dataGridView2.Rows[j].Cells[1].Value)
                  {
                       if (k != 0)
                      {
                          items.Rows.RemoveAt(j);
                          dataGridView2.DataSource = items;
                      }
                     k= k+1;
                  }
              }
          }
  </code></pre>
  
  <p>But no luck. I should get result like below.Please help me to solve.</p>
  
  <p><img src="https://i.stack.imgur.com/qYyGm.png" alt="without duplicate"></p>