Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9138405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:15:08+00:00 2026-06-17T09:15:08+00:00

I need some assistance with writting a VB function to compare the system time

  • 0

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…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:15:09+00:00Added an answer on June 17, 2026 at 9:15 am

    “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:

    Dim systemTime As date = Date.Now
    Dim fieldTime As Date = SCHD_DTM.CurrentValue
    Dim result As Double= (fieldTime - systemTime).TotalMinutes
    
    If result <= 0.25 Then
        RowATTrs("style") = "background-color:Red"
    ElseIf result > 0.25 & result < -0.5 Then
        RowATTrs("style") = "background-color:Yellow"
    ElseIf result > 0.5 & result <= 2 Then
        RowATTrs("style") = "background-color:Green"
    End If
    

    However, not sure if fieldTime is supposed to be lower than Date.Now. Then swap the variables in (fieldTime - systemTime).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some assistance. The code uses a date() function to acquire the report
I need some assistance with some javascript/jquery I have put in place. The function
Greetings. Need some assistance with creating a computed column on this table: USE [ScienceWorksSummary]
I need some assistance with this code: http://jsfiddle.net/N5xTJ/1/ The last column already is dynamic
I need some assistance understanding how variables of a typedef work with structs /*This
I am working on some simple form validation and need some assistance. Basically, I
I need some jQuery assistance. I'm using https://github.com/jbutz/bootstrap-lightbox for my lightbox, basically what I
I'm in need of some assistance with Ruby on Rails and Sqlite3. This is
I know the title is ridiculously long, but I'm in need of some assistance
I need some assistance writing what should be a fairly basic .BAT file. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.