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 9162933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:19:53+00:00 2026-06-17T14:19:53+00:00

So I am working on someone else’s code for a scheduler type program. He

  • 0

So I am working on someone else’s code for a scheduler type program. He creates a timer to run every 10 seconds to check a list of schedules to see if any has to be run. I modified to update the Schedule.button.forecolor depending on if there are schedules or if any are currently running (yellow and green, respectively). The code for the timers are on the schedule form file

The problem is that the timers are called on project startup, which makes sure that a user doesn’t have to actually click on the scheduler form to actually start the timer. But when this timer is called on startup, because the timer is on the form code, an instance of this form is made to make the timer start. Of course, later when the page is accessed, it is a different instance so the buttons will not update.

How can I resolve this problem? Should I refactor the old code to separate the timer instance in a different file, then call it? Or is there a better way to start the timer on startup?

  • 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-17T14:19:54+00:00Added an answer on June 17, 2026 at 2:19 pm

    For the sake of single responsibility I’d suggest to seperate the timer code from all the UI. You could raise a custom CheckForUpdates event at the appropiate time (in the timer class), which gets caught in every mask/instance, which needs button updates.

    That makes your code more extensible as well.

    Edit: is there a database implied in your project as well? It seems to me like the timer checks every ten seconds, if there are any tasks to be run. It would be more efficient if this check was serverside. And everytime a task has to be run, the server sends a message to the client.

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

Sidebar

Related Questions

I am working on someone else's code, and see things like: if ((somevariable) >
I'm working on a site someone else developed. They used the following jQuery code
I've been working with a program someone else has made and I wanted to
I'm working with someone else's code on a device which can put an image
I am working with someone else's code. The code was originally designed so that
I am working on maintaining someone else's code that is using multithreading, via two
I am working with someone's else's code and am trying to make a simple
Working with someone else's code here. It compiles just fine with gfortran. Under Portland
I'm working with someone else's code, and I want to be able to see
I am working on someone else's code and making significant modifications. (I am converting

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.