VB.net
Public Sub Delay(ByVal mm As Long)
Dim current = DateTime.Now
While current.AddMilliseconds(mm) > DateTime.Now
Application.DoEvents()
End While
End Sub
C#
public static void Delay(int mm)
{
DateTime current = DateTime.Now;
while (current.AddMilliseconds(mm) > DateTime.Now)
{
Application.DoEvents();
}
return;
}