Hi all
I'm trying to shade a cell based on a date difference between column 7 & 8.
It seams to work accept column 8 seams to be the one being shaded instead of column 7.
I have googled but can't find a solution to have the calculatin being made on when column 8 being loaded but the formatting being applied to column 7.
Private Sub gvStatus_CellFormatting(ByVal sender As Object, ByVal e As DataGridViewCellFormattingEventArgs) Handles gvStatus.CellFormatting
Dim Closing, Tobemeasured, tobedesign As Date
Dim NumberOfWeeks As Integer
If Not IsDBNull(gvStatus.Item(6, e.RowIndex).Value) Then
Closing = gvStatus.Item(6, e.RowIndex).Value
End If
Select Case e.ColumnIndex
Case 7
If Not IsDBNull(e.Value) Then
Tobemeasured = e.Value
End If
Case 8
If Not IsDBNull(e.Value) Then
tobedesign = e.Value
Else
NumberOfWeeks = DateDiff(DateInterval.Weekday, Now(), Closing)
If NumberOfWeeks > 5 Then
e.CellStyle.BackColor = Color.Red
End If
End If