|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Dynamically Create Timers are Run-TimeI am trying to figure out how to create multiple timers at run-time (which could vary each time) that I can then reference? Basically I have a service that will check a registry key and each subkey under that registry key will require a timer in which each subkey will contain a couple of settings such as the timer interval and job name. I can enumerate and read the registry no problem, but I am unclear how to create a timer for each one of those subkeys and then be able to reference that timer setting it's interval based on the setting in the registry for that job. I know I can add the handlers to it and use the sender to determine which timer has fired, but the creation of the timers dynamically like that and understanding how they would be referenced is what confuses me. Can anyone help me with some sample code on how this could be done. I have been continuously searching for the answer but have not found anything that would help me. Thanks in advance for your help, Ron GoneRural wrote:
Show quoteHide quote > Hello, Make an array list and throw the timers into the array list. Then you > > I am trying to figure out how to create multiple timers at run-time > (which could vary each time) that I can then reference? Basically I > have a service that will check a registry key and each subkey under > that registry key will require a timer in which each subkey will > contain a couple of settings such as the timer interval and job name. > I can enumerate and read the registry no problem, but I am unclear how > to create a timer for each one of those subkeys and then be able to > reference that timer setting it's interval based on the setting in the > registry for that job. I know I can add the handlers to it and use the > sender to determine which timer has fired, but the creation of the > timers dynamically like that and understanding how they would be > referenced is what confuses me. > > Can anyone help me with some sample code on how this could be done. I > have been continuously searching for the answer but have not found > anything that would help me. > > Thanks in advance for your help, > Ron > can itterate through you arraylist to see each and every one of your times. Dim Arr as new ArrayList Dim T as New Timer With T 'Set methods End With Arr.Items.Add(T) Chris Excellent, thanks I will give this a try and see how that works. I
appreciate the help. Ron Ok, that works great for creating the array of timers I need based on
number of keys it detects. My last question would be how I can determine which timer belongs to which job? Should I create a class which inherits the timer and then add a "tag" and "execute" property so to speak that I would set the name of the job and the command to execute when the time elapses? Thanks again for the help, Ron
Frustrated trying to use "pure" VS.NET to access database properties
ADO.NET Error Export to excel without using office automation Detect if Themes are enabled? SQLConnection VB Express - How to access query value on my form? VS2003 and VS2005 Side by Side Setting focus Opposite of Graphics.FromImage Wall chart of VB.net class structure? |
|||||||||||||||||||||||