What's the easiest way to run a periodic task in the background in VB?
For example: Update a label every second with the current time, while still allowing the form to be available.
What's the easiest way to run a periodic task in the background in VB?
For example: Update a label every second with the current time, while still allowing the form to be available.
Timer
component to your formInterval
to the time between updatesEnabled
property or calling its Start
method) Tick
event by doing whatever updates are necessary.Your handler would look something like this:
Private Sub Timer1_Tick(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Timer1.Tick
label1.Text = GetCurrentStatus()
End Sub