I need some assistance with writting a VB function to compare the system time with my column 1 datetime variables, and return a different color background. Here is the condition…
- if scheduledTime is 0-15mins late, then background row color red
- if scheduledTime is 15mins-30mins late, then background row color yellow
- if scheduledTime is 30mins-2hours late, then background row color green
Row Rendered event:
Row_Rendered();
DateTime systemTime = DateTime.Now();
DateTime fieldTime = SCHD_DTM.CurrentValue;
DateTime result As Integer = DateTime.Compare(fieldTime,systemTime).TotalMinutes
if result <= 0.25 Then
RowATTrs("style") = "background-color:Red";
else if result > 0.25 & result <- 0.5 Then
RowATTrs("style") = "background-color:Yellow";
else if result > 0.5 & result <= 2 Then
RowATTrs("style") = "background-color:Green";
End If
This is what I had and Im getting no response…
“Im getting no response” is not a good description of an error or undesired behaviour. However, you are mixing C# and VB.NET in your code. Of course that won’t compile.
But this should:
However, not sure if
fieldTimeis supposed to be lower thanDate.Now. Then swap the variables in(fieldTime - systemTime).