title: Compare rows of a datagridview and remove repeated rows
body: <p>I am trying to compare the rows of a Datagridview and that it removes the rows that are repeated.
  I think that I´m doing something wrong. Here´s the code:</p>
  
  <pre><code> public void Compare(DataGridView grv)
      { 
       grv.Sort(grv.Columns[0],ListSortDirection.Ascending);
       for ( int row = 0; row &lt; grv.Rows.Count; row++)
       {
       for ( int col = 0; col &lt; grv.Columns.Count; col++)
       {
           int rowx=1;
           if (grv.Rows[row].Cells[col].Value != null &amp;&amp; grv.Rows[row].Cells[col].Value.Equals(grv.Rows[rowx].Cells[col].Value))
           {
               if (col == grv.Columns.Count - 1)
               {
                   grv.Rows.RemoveAt(row);
                   grv.Sort(grv.Columns[0], ListSortDirection.Descending);
               }
           }
           else
           {
               grv.FirstDisplayedScrollingRowIndex = grv.RowCount - 1;
               grv.Rows[grv.RowCount - 1].Selected = true;
           }
          }
       }
      }
  </code></pre>