i got a datagridview which displays data from database(MS Access)
the datagridview display the data correctly..
now i want to change the colour of the dgvRemind
I did this one and it works , I just checked if the record is expired or about to expire within ongoing month. you can just change the date interval as your need. I used DataBinding Complete event of Data GridView
Private Sub grdMembersInfo_DataBindingComplete(sender As System.Object, e As System.Windows.Forms.DataGridViewBindingCompleteEventArgs) Handles grdMembersInfo.DataBindingComplete
For i = 0 To grdMembersInfo.Rows.Count - 1
Dim expDate As Date = grdMembersInfo.Rows(i).Cells("iCardExpiryDate").Value
If DateDiff(DateInterval.Month, Date.Now, expDate) <= 0 Then
grdMembersInfo.Rows(i).DefaultCellStyle.BackColor = Color.LightPink
Else
grdMembersInfo.Rows(i).DefaultCellStyle.BackColor = Color.LightGreen
End If
Next
End Sub