I'm working on a VB forms project (using VB 2010 Express) that currently has a number of database or API interrogation subroutines. These subs can each take several minutes to run.
Form name = Form1
There's a single label for overall elapsed time lblElapsed
Sub names = Sub1, Sub2, etc...
The subs are started by button_click events - next to each button is a label: lblSub1, lblSub2, etc.
While the application is running, I'd like to display the overall elapsed time since Form1_Load, in the label (lblElapsed) updated each second. I'd also like the whole form redrawn (if that's the right word for it!) every second or two Otherwise, when I tab between other programs and back to it, the form is only partially rendered.
While each sub is running, I'd like to display a label (lblSub1, lblSub2, etc.) with the word "running -" and the elapsed time, updated each second.
When each sub completes, I'd like the associated label to display "completed - " and the elapsed time for that sub to complete.
I'm floundering somewhat, having seen a load of examples of system.threading.timers which don't quite explain how they work, or can be made to work in my scenario. I've got a standard timer to work but it stops updating as soon as any sub is active.
A basic example of code to achieve this would really help.