### Delay Sub

There is no Delay function, but several solutions possible.
Delay Sub
`Sub Delay (DurationMs As Int)
Dim target As Long = DateTime.Now + DurationMs
Do While DateTime.Now < target
Loop
End Sub`
Be Aware:
On most platforms this will cause high CPU utilization, more commonly called "busy waiting".
It is better to use a Timer (see example below).
Delay by Timer
'Setup the delay timer with 2 seconds interval
`Sub Class_Globals
Public tmr As Timer
Public tmrinterval As Long = 2000 ' 2 seconds
...
End Sub`
'Init the timer and start
`Public Sub Initialize
tmr.Initialize("tmr", tmrinterval)
tmr.Enabled = True
End Sub`
'Handle timer ticks
`Sub tmr_Tick
'Add any action
End Sub`

Changed: , Category: Delay, File: T6C185M1339.htm, ID: 1339