January 15th, 2013, 10:40 AM
Comparing field value to system clock
I'm very new to VB, and excited to learn it. I have a problems with my conditional logic that I have written which compares the field value DateTime from my table to the system time, and return a different background color. Here is my logic..
if scheduledTime is 0-15mins late, then background color red
if scheduledTime is 15mins-30mins late, then background color yellow
if scheduledTime is 30mins-2hours late, then background color green.
Here is my code so far...
Thanks for the help!
Dim systemTime As Date = Date.Now
Dim fieldTime As Date = SCHD_DTM.CurrentValue
Dim result As Double = (fieldTime - systemTime).TotalMintues
if result <= 0.25 Then
RowATTrs("style") = "background-color:red;"
Else If result > 0.25 & result <= 0.5 Then
RowATTrs("style") = "background-color:yelow;"
Else If results > 0.5 & result <= 2 Then
RowATTrs("style") = "background-color:Green;"
Click Here to Expand Forum to Full Width