Search code examples
c#winformscompact-framework

What might corrupt a winforms progressBar?


A progressBar occasionally stops updating (along with the rest of the GUI) and is missing a rectangular section. This has only been seen intermittently on the target windows-ce 5.0 tablet device, never on windows 7. progressBar.Refresh() after changing progressBar.Maximum does not help. The exact sequence to cause it is unknown and I am unable to run the debugger on the target device (I use the PC platform to debug the application, but this issue has never been seen when running the app on the PC). What might be causing this? The progress bar and its associated Label are updated this way.

progressBar.Value = Status.value;
label.Text = Status.value;

label.Text is always correct.


Solution

  • The root cause is making changes to the gui outside the gui thread. The actual solution was making all changes to the progress bar in a System.Windows.Forms.Timer.