I am writing a program that steps through a number of testing steps in one of three modes. Mode 1 is simply "run as fast as the processor can go". Mode 2 is a manual "click to advance the step". Mode three is suppossed to be a "step slowly by a predetermined pause". It is this third mode that I am having trouble with. The other two modes work great. The problem is that before the program is temporily paused, a number of labels have to be updated, including the "Step Number" label. After trying things like "Thread.Sleep(500)" and "do nothing" for loops, I find that the program will slow down, but the form labels are not updated between pauses. It looks to me like the thread goes off track for a while then after the pause returns with all of my labels left either not updated or corrupted. Is there a pause routine that will smoothly advance through my test steps? I need about a 1/2 sec pause between steps.
NOVICE3

Recommended Answers

All 2 Replies

//update all your labels
Application.DoEvents();
Thread.Sleep(500);

Thanks so much. It never ceases to amaze me how the experienced programmers know all of the little tricks. Somewhere there must be a source of these kind of solutions. I looked all over the intenet for solutions. I found many, both long and short code snippets, none of which worked. Your solution worked perfectly and is sooooo sinple, I am amazed.
Thanks again.
NOVICE3

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.