private void CheckDueDate() { int result = 0; foreach (DataGridViewRow row in dataGridView1.Rows) { var dateToCompare = Convert.ToDateTime(row.Cells[4].Value); result = DateTime.Compare(dateToCompare, DateTime.Now); if (result < 0) { row.Cells[4].Style = DataGridViewHelper.Danger(); } } }