Hey guys! Hope everyone is doing great! As the tittle says, I am finishing a project, which is a medical registry patients for a hospice. I have a table named Appointments and this table has a column named Appointment Time Which handles the date and time of the appointments. The column was designed with the date/time feature in access. I am trying to get a color change in the rows with the date, like, if the appointment date has passed, changes to red and if still not passed stays white. Did some reseach and came out with this code: Private Sub Appointments_DataBindingComplete(sender As System.Object, e As System.Windows.Forms.DataGridViewBindingCompleteEventArgs) Handles AppointmentsDataGridView.DataBindingComplete For i = 0 To AppointmentsDataGridView.Rows.Count - 4 Dim expDate As Date = AppointmentsDataGridView.Rows(i).Cells("Appointment Time").Value If DateDiff(DateInterval.Month, Date.Now, expDate) <= 0 Then AppointmentsDataGridView.Rows(i).DefaultCellStyle.BackColor = Color.Red Else AppointmentsDataGridView.Rows(i).DefaultCellStyle.BackColor = Color.White End If Next End Sub Everytime I run the debugger comes out with the error Column Appointment Time Cannot be found. Any one can see what I'm doing wrong
I tried But came out with the same error. What I did was change the Appointment Time which is the name of the column to the number of the column. It worked but is highlighting the entire row instead of the column. What I actually wants is to hightlight in red the appointments that has passed and the other that not stay in white.