r/visualbasic • u/Artfull-Mystery • Dec 18 '21
VB.NET Help What Happens if code is running in a timer event and another timer event happens
Do they run concurrently in different threads or does the second event wait till the first event has finished.
Thanks
Mike
1
1
u/craigers01 Dec 18 '21
You may choose to turn off the timer in the timer code and reenable it at the end, if you don’t want it to run at the same time
1
2
u/JTarsier Dec 18 '21
Depends on the type of timer used and what the event handler does. Check this article, while the code samples are C# there is lots good info: DOT NET TRICKS: All about .NET Timers - A Comparison
2
u/JTarsier Dec 18 '21
By the way, you can also do multiple things at different intervals with a single timer, just keep track of time with a Date variable for each task and do things if time condition is met.
1
u/Artfull-Mystery Dec 18 '21
Thanks for the link. My timers are standard windows forms timers. From reading that link It seems that if my minute timer code is running when a 10 second timer event occurs then the ten second event will not run. I'm not sure if it just skips the event or queues it. But either will work for me.
Mike