Results 1 to 3 of 3

Thread: Timer. Give me an idea

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Santo Domingo,D.N., Dom. Rep.
    Posts
    707

    Talking Timer. Give me an idea

    My App reads a table.
    The table has N records.
    Each record has instructions that need to be executed on different time according to users setting (.i.e.: record 1 every 10 minutes, record 2 every 5 minutes,ect.)
    The App is always running, so this process never ends (only if the app ends)

    Questions:
    1. Should i have to have a timer for each record?
    2. In fact: I dont have any idea how to start.

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Use a control array of timers with different intervals.
    Have the index of each timer = the index of each instruction to execute (stored as a udt or string etc.)

    Then when timer with index = n fires, execute instruction n
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    1) Pick a minimum time limit e.g. 1 minute, and make sure that all the rows conform to this - so row one would be 10, row two 5 and so on, etc etc.
    2) Add a timer to your application, that fires once a minute.
    3) Add a 2 class files to you application - clsEvent and clsEvents, where clsEvent is the parent container of clsEvent.
    4) When your app loads, load all those event records into the class files (for quicker reference later).
    5) When those events are changed (use a trigger, or whatever else you want), reload the events (or just the one(s) that have changed)
    6) When the timer from (2) fires:
    6)a) Disable the timer
    6)b) Loop through the events in the class file, comparing the current timer thingymajig with the event's timer thingymajig
    6)b)i) If they mathc, and do whatever event is supposed to do.
    7) Re-enable the timer.



    If that doesn't work - don't shoot me!!!

    Regards,
    Brian

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width