This is a migrated thread and some comments may be shown as answers.

RadProgress bar fails to update.

1 Answer 133 Views
ProgressBar
This is a migrated thread and some comments may be shown as answers.
JUSTIN
Top achievements
Rank 1
JUSTIN asked on 20 Dec 2012, 09:24 PM
I'm not understanding why it fails to update in another thread correctly if the process is running fast. Example

If I do this, this will freeze the progress bar until its completed. It will get to a certain spot then stop.
radProgressBar2.Maximum = 1500;
for (var i = 1; i < 1500; i++)
{
    var p = i;
    radProgressBar2.Value1 = p;
    Thread.Sleep((int)numericUpDown1.Value);
}
radProgressBar2.Value1 = 0;
radProgressBar2.Text = "Task Completed!";


If i do this 

radProgressBar1.Maximum = 1500;
for (var i = 1; i < 1500; i++)
{
    var p = i;
    radProgressBar1.SafeInvoke(() => radProgressBar1.Value1 = p, false);
    Thread.Sleep((int) numericUpDown1.Value);
}


using a custom invoke it works just fine. I dont understand why it doesnt work correctly with the build in feature. This is also happening on the status progress bar as well.. Here is a quick app source.

Also it seems to work with the built in features using Win7 or above, Its freezing on windows xp sp3 


Edit: Never mind i can not attach rar, or .zip to this thread. 

Uploading a video to demonstrate.

1 Answer, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 25 Dec 2012, 02:31 PM
Hello Justin,

Thank you for writing.

The reason why the progress bar does not update when you are doing something in the UI thread is because it has to recalculate its layout and then draw itself. It is always advisable to perform long running tasks in a background thread. As to the difference between XP and Win 7, there are differences in the lifecycle and message processing of applications in the different operating systems.

I hope this clears things up. If you need further assistance, I would be glad to help.
 
All the best,
Ivan Petrov
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
ProgressBar
Asked by
JUSTIN
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
Share this question
or