Ad space (banner)
๐Ÿ”ทVB.NET Lessons
Lesson 56 / 68

Pausing for a set time (Thread.Sleep)

This lesson covers pausing with VB.NET's Thread.Sleep, with the aim of understanding the basics of programs that deal with time.

Threading.Thread.Sleep(milliseconds) pauses execution for the time you specify. 1000 is one second — useful when you deliberately want to wait, for pacing or presentation.

The sample code prints "Starting", waits one second with Threading.Thread.Sleep(1000), and then prints "Ran after 1 second". Run it and you can feel the gap between the messages.

A common early stumble is leaning on Sleep() so much that the program becomes unresponsive. Everything else stops during a sleep, so it needs care in an application whose window must not freeze.

In professional work, the equivalent is used wherever timing has to be controlled — spacing out retries, avoiding hammering an API.

๐Ÿ“– Reference code
โœ๏ธ Your code
Type your code, then press "Run"

๐Ÿงช This site can't compile or run VB.NET directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ€” nothing is sent anywhere).

Ad space (banner)
Ad space (in-article)