Making a settable time delay in C#

Is it possible to make a delay in the C# code such that if I wanted to make it possible to have a 3 second delay at certain points in the code that would simply hold the code for 3 seconds and then continue on again I am trying to make a program that will take measurements and I need it to run the lab instrument for a set time, and not progress in the code while it is running. I would also like to be able to change the time delay from the user interface rather than having to change the code.
Thanks,
SVandal


Answer this question

Making a settable time delay in C#

  • jheddings

    You can pause current app thread by using this code:

    System.Threading.Thread.Sleep(3000);



  • PDav

    Why then if I use "System.Threading.Thread.Sleep(3000);" inside a cycle applying it to every step I get ...
    {
    begin
    big pause
    final result
    }

    ... without any middle positions

  • Making a settable time delay in C#