Does anyone know if it is possible to check the cell colour at runtime and make a decision on it ?
I have a DGV that if the time in each cell is past a specific time it will paint the cell a particular color.
This ticks through once a minute. It works perfect.
The problem lies when I have a cell that is over a certain time I want to write to the audit and fire an email off. This works everytime the tick happens.
I tried
Expand|Select|Wrap|Line Numbers
- If DateAdd(DateInterval.Minute, 60, CDate(DataGridView1.Rows(y).Cells(x).Value)) < DateTime.Now.ToString("HH:mm") And DataGridView1.Rows(y).Cells(x).Style.BackColor = Drawing.Color.Yellow Then
- SendMail("Daily Process Behind Schedule By 60 minutes", DataGridView1.Rows(y).Cells(0).Value & " ----- " & DataGridView1.Rows(y).Cells(x).OwningColumn.Name.ToString)
- DBAction("INSERT INTO AUDIT (AUDIT_DATE, AUDIT_TIME, USERID, COMPANY, [ACTION], ACTION_DUE_TIME) VALUES ('" & DateTime.Now.ToString("dd/MM/yyyy") & "','" & DateTime.Now.ToString("HH:mm") & "','TaskManager Agent','" & DataGridView1.Rows(y).Cells(0).Value & "', 'Email Sent - Not Completed - " & DataGridView1.Rows(y).Cells(x).OwningColumn.Name.ToString & " - 60mins','" & DataGridView1.Rows(y).Cells(x).Value & "')")
- DataGridView1.Rows(y).Cells(x).Style.BackColor = Drawing.Color.Purple
- GoTo bypass
- End If
Is there another way I can set a property that will mean that only 1 audit entry is inserted and one email gets sent ?
Thanks in advance
Dennis