Solved this with this code - hope this helps someone else in future:
public void HighlightDuplicate(DataGridView grv)
{
for (int currentRow = 0; currentRow < grv.Rows.Count - 1; currentRow++)
{
DataGridViewRow rowToCompare = grv.Rows[currentRow];
for (int otherRow = currentRow + 1; otherRow < grv.Rows.Count; otherRow++)
{
DataGridViewRow row = grv.Rows[otherRow];
bool duplicateRow = true;
if (!rowToCompare.Cells["ENVA_APP_ID"].Value.Equals(row.Cells["ENVA_APP_ID"].Value))
{
duplicateRow = false;
break;
}
if (duplicateRow)
{
rowToCompare.DefaultCellStyle.BackColor = Color.Red;
rowToCompare.DefaultCellStyle.ForeColor = Color.Black;
row.DefaultCellStyle.BackColor = Color.Red;
row.DefaultCellStyle.ForeColor = Color.Black;
}
}
}
}