Please have a look at the attached picture.
I am creating a Windows Form application in C#. I need to display the 'carry' string bit-by-bit with a considerable difference of appearing time.
For example:
if the carry string is 11011
I need to diplay it like-

**1
*11//overwrite the above
011//overwrite the above. I have used Thread.Sleep() and timers, but then UI gets locked and the whole string is displayed once the "pause" is over.

Use

Application.DoEvents();

before calling Thread.Sleep() HTH

The Thread.Sleep() will still lock the UI (you are telling it to sleep, after all). If you want things to happen on a schedule use a timer.

commented: The best way +14

Simple piece of code to make 5 second delay:

for (DateTime sec = DateTime.Now;  DateTime.Now < sec+ new TimeSpan(0,0,5); )
     Application.DoEvents();

I would suggest you to use a loop and overwrite the text box for a 1 sec delay...
for()
{
texbox += textbox + string;
Thread.Sleep(1000);
}
or
may be u can use a timer like momerath said..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.