string tempStr = String.Empty;
private void dataGridView1_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
{
if ((dataGridView1.Rows[e.RowIndex].Cells[1].Text) != tempStr)
{
dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Blue;
tempStr = dataGridView1.Rows[e.RowIndex].Cells[1].Text;
}
else
{
dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Red;
}
}
I did not test it, there may be syntax errors.