Hello! I'm working with a DataGridView that I want to format based on the condition of whether or not a date has passed. For example: If the date in a cell is past the current date, that cell and its row are formatted with the forecolor red. My current code is below, and while it doesn't present me with any errors, it just plain doesn't do anything! Any help would be greatly appreciated!
Private Sub dataGridView1_CellFormatting(ByVal sender As Object, ByVal e As DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting If Me.DataGridView1.Columns(e.ColumnIndex).Name = "Due Date" Then If e.Value IsNot Nothing Then Dim dgvdate As String = e.Value.ToString ' MsgBox(dgvdate) If dgvdate = "5" Then e.CellStyle.ForeColor = Color.Red Else e.CellStyle.ForeColor = Color.Green End If End If End If End Sub