skip to content »

Progress bar not updating

progress bar not updating-20

Hi, I have an import feature that I want to display progress while its running. the import feature is located in a Mdi Child the progress bar is located in a rad Status Strip on the Parent form here is the code I have and yet the Progress bar doesn't move untill after the loop is done.

progress bar not updating-84progress bar not updating-38progress bar not updating-84progress bar not updating-38

Is there any reason why the UI Thread of a Progress Bar Window would be affected by a backgroundworker? Much better to write your application correctly and allow the UI thread to pump for messages normally. If it's a small desktop app that does a simple update for example, you could spend 15 minutes writing it with Application.I have a Progress Bar Window which has a progressbar and a cancel button on it which I use to report progress on file I/O.However, the UI Thread of the Progress Bar Window and my main window both hang despite all the work being done in a backgroundworker.Run Worker Completed = Event Count Log Lines Run Worker Completed; i Count Log Records. Read))); I've tried wrapping the value setter line in a dispatcher.invoke delegate but that gives me a stack overflow(I shouldn't have to have a dispatcher.invoke line anyway as backgroundworker calls Progress Changed in the UI Thread, right? I have checked msdn and googled but I can't seem to find anyone else with this problem.Worker Reports Progress = true; i Count Log Records. EDIT Apologies, I did not realise my simplified code blocked the UI Thread, I get exactly the same behaviour despite using a backgroundworker so I erroneously assumed they were equivalent.The progress bar percentage is updated from a background worker and is based the on the amount of bytes copied compared to the total amount of bytes of all files.

My question is this: on the 1st pass, when the value gets to 1000000 the actual colored bar only displays about 50-75% across, but never 100% across, even though the value has reached the maximum.

The progressbar is rendered, as is my main window, but does not update whilst the backgroundworker does its thing.

The following code is called at the very end of the constructor of the main window: i Count Log Lines Progress Bar = new Progress Bar Window(); i Count Log Lines Progress Bar.cancel Button.

Click = Event Count Log Lines Progress Bar Cancel Button Clicked; i Count Log Lines Progress Bar.

Show(); i Count Log Records = new Background Worker(); i Count Log Records.

They are asynchronous and in the case that you have they may not be updated at the exact time you need them.