Hello,
I am writing a C# program that uses WinForms. In the past, I have written programs that
measure voltages or other parameters from sensors and put them on a timer read. This worked well when needing to access this data in a single form.
But now, I have a situation where I need to be able to have the timer running all of the time, regardless of what form I am on. There could be 4 or 5 forms in my program.
I tried to put the timer in my MainForm, but that did not work very well, as I had to create another instance of MainForm, and that threw off the timers.
What I need is a method to be able to have a process or form running all of the time, and only create a single instance of it.
Can anyone point me to some information or code which explain a better method of what I'm trying to do?
Thanks
Loading

FroglegRank #1,020 · 1.9K reputationPosted Jun 7, 2011, 1:32 PM EDT
Sam HobbsRank #107 · 20.5K reputationPosted Jun 7, 2011, 11:16 PM EDT
Glenn PattonRank #6,159 · 275 reputationPosted Jun 22, 2012, 6:10 AM EDT
Glenn
Sam HobbsRank #107 · 20.5K reputationPosted Jun 22, 2012, 6:28 AM EDT
In this situation, the question is vague. I assumed that the timer is being used to do something periodically; in other words, some IO is initiated by a timer. In other words, it could be that neither the sensor nor the computer with the timer are doing anything and then a timer is used so that the computer knows to check the sensor. If that is what is being done then it is a valid use of a timer.
Glenn PattonRank #6,159 · 275 reputationPosted Jun 22, 2012, 7:29 AM EDT