473,385 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Dynamically Create Timers are Run-Time

Hello,

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

May 16 '06 #1
3 3904
GoneRural wrote:
Hello,

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


Make an array list and throw the timers into the array list. Then you
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
May 16 '06 #2
Excellent, thanks I will give this a try and see how that works. I
appreciate the help.

Ron

May 16 '06 #3
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

May 16 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Thana N. | last post by:
Hi All, I've found that kbAlert notify that "System.Threading.Timers Class Library may unexpectedly run in the .NET Framework 1.1" (http://www.kbalertz.com/Feedback_843561.aspx). I would like...
0
by: Dmitry Demchuk | last post by:
Hi everybody. Recently I ran into situation with System.Threading.Timer in my ASP.NET application. I reinstalled Windows on one of my servers and got timers stop firing events after while, they...
4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
1
by: melanieab | last post by:
Hi, I'm have a datagrid, and I'm trying to have a tooltip pop up if a cell has been hovered on for 2 seconds. I was thinking of using DataGrid.Hover, but then decided to try this instead: ...
4
by: Dave | last post by:
MS Virtual Server 2005 (not R2) with .Net 2003 I created a Console App and A windows form both with Timers in it. For the console i used system.timers and the windows form i used...
4
by: Water Cooler v2 | last post by:
Do timers run on the same thread that creates them or (internally) a new thread is spawned per timer?
5
by: Tony Gravagno | last post by:
I have a class that instantiates two Timer objects that fire at different intervals. My class can be instantiated within a Windows Form or from a Windows Service. Actions performed by one of the...
20
by: Nickolai Leschov | last post by:
Hello all, I am programming an embedded controller that has a 'C' library for using its system functions (I/O, timers, all the specific devices). The supplied library has .LIB and .H files. ...
1
by: krishna81m | last post by:
I am unable to create a list of objects dynamically. I run a SQL query on the database and populate objects of types that I also know aprior. I read the query as a string, run it on the database and...
4
by: =?Utf-8?B?R29yZnk=?= | last post by:
Hey everyone. This is only my first week with C#, but I use actionscript a lot in Flash, so I have a very basic understanding of programming, but bear with me... I am trying to create a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.