Make your own free website on
Pause Your Program

'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
'Add 1 CommandButton to your form (named Command1),
'And 1 TextBox.
'When you will press the button the program will pause for 3 seconds.
'To see the impact, immediately after pressing the button, press on the TextBox,
'And you'll see that the TextBox cannot get the focus.
'Insert this code to the module :

Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

'Insert this code to your form:

Private Sub Command1_Click()
'Replace the 3000 with the number of milliseconds you want to pause
'(1000 milliseconds=1 second)

Sleep 3000
End Sub

Go Back