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-

*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.

Recommended Answers

All 4 Replies



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); )

I would suggest you to use a loop and overwrite the text box for a 1 sec delay...
texbox += textbox + string;
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, learning, and sharing knowledge.