Hi
I have a datagridview with 9 Processes each process holds dates for stating and compleating a job.
When a process is Late a cell back color is set to yellow, when today is the day the same date on the cell the date gets bolded,if the date is altered by the admin the dates forecolor is red and when is compleated a date gets crossed out.
My Problem is some cells on one process have fore color is white when its set to red.
This is my code.
Private Sub Dgv_Formate(ByVal e As DataGridViewCellFormattingEventArgs, ByVal Stat As String, ByVal processDate As Date, ByVal Extra_Days As Boolean)
Dim Style As Font = Me.DGV_Machining.DefaultCellStyle.Font
Dim thisdate As Date = "#12/09/2016#" 'Today()
Dim started As New Proces
If Me.DGV_Machining.Rows(e.RowIndex).Cells(Stat).FormattedValue = "n" And Not Extra_Days Then
If processDate < thisdate Then
e.CellStyle.BackColor = Color.Yellow
ElseIf processDate = thisdate Then
e.CellStyle.Font = New Font(Style, FontStyle.Bold)
End If
ElseIf Me.DGV_Machining.Rows(e.RowIndex).Cells(Stat).FormattedValue = "n" And Extra_Days Then
If processDate < thisdate Then
e.CellStyle.BackColor = Color.Yellow
e.CellStyle.Font = New Font(Style, FontStyle.Italic)
e.CellStyle.ForeColor = Color.Red
ElseIf processDate = thisdate Then
e.CellStyle.Font = New Font(Me.Font, FontStyle.Italic + FontStyle.Bold)
e.CellStyle.ForeColor = Color.Red
Else
e.CellStyle.BackColor = Color.White
e.CellStyle.Font = New Font(Style, FontStyle.Italic)
e.CellStyle.ForeColor = Color.Red
End If
ElseIf Me.DGV_Machining.Rows(e.RowIndex).Cells(Stat).FormattedValue = "y" And Not Extra_Days Then
e.CellStyle.BackColor = Color.White
e.CellStyle.Font = New Font(Style, FontStyle.Strikeout)
e.CellStyle.ForeColor = Color.Black
ElseIf Me.DGV_Machining.Rows(e.RowIndex).Cells(Stat).FormattedValue = "y" And Extra_Days Then
e.CellStyle.ForeColor = Color.Red
e.CellStyle.BackColor = Color.White
e.CellStyle.Font = New Font(Me.Font, FontStyle.Italic + FontStyle.Strikeout)
End If
End Sub
If I comment the line 31 the dates Show.