|
-
Aug 19th, 2002, 08:06 AM
#1
Thread Starter
Fanatic Member
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.
-
Aug 19th, 2002, 08:10 AM
#2
Retired VBF Adm1nistrator
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]
-
Aug 19th, 2002, 08:16 AM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|