-
January 15th, 2013, 11:40 AM
#1
Comparing field value to system clock
Hello All,
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...
Code:
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;"
End If
Thanks for the help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|