How do I get my C# program to sleep for 50 msec?

TK. picture TK. · Sep 18, 2008 · Viewed 352.7k times · Source

How do I get my C# program to sleep for 50 milliseconds?

This might seem an easy question, but I'm having a temporary brain failure moment!

Answer

Isak Savo picture Isak Savo · Sep 18, 2008
System.Threading.Thread.Sleep(50);

Remember though, that doing this in the main GUI thread will block your GUI from updating (it will feel "sluggish")

Just remove the ; to make it work for VB.net as well.