Text in form title bar not keeping up (me.text)
-
Hi, I have an app that retrieves and calculates a lot of data. The whole process may take about 20 minutes. To prevent the user from thinking that the app has crashed, I added a progress bar, and to give the user a better idea of the progress, I make the form's title bar display a percentage. The problem is that at pretty much any percentage the form no longer updates itself. The application keeps running, no problem, but the progress bar and percentage in the title bar get stuck, which effectively defeats the purpose. Can anyone tell me why this may happen ? Cheers, Johan
My advice is free, and you may get what you paid for.
-
Hi, I have an app that retrieves and calculates a lot of data. The whole process may take about 20 minutes. To prevent the user from thinking that the app has crashed, I added a progress bar, and to give the user a better idea of the progress, I make the form's title bar display a percentage. The problem is that at pretty much any percentage the form no longer updates itself. The application keeps running, no problem, but the progress bar and percentage in the title bar get stuck, which effectively defeats the purpose. Can anyone tell me why this may happen ? Cheers, Johan
My advice is free, and you may get what you paid for.
Johan Hakkesteegt wrote:
I have an app that retrieves and calculates a lot of data. The whole process may take about 20 minutes. To prevent the user from thinking that the app has crashed, I added a progress bar, and to give the user a better idea of the progress, I make the form's title bar display a percentage. The problem is that at pretty much any percentage the form no longer updates itself. The application keeps running, no problem, but the progress bar and percentage in the title bar get stuck, which effectively defeats the purpose. Can anyone tell me why this may happen ?
The UI will not respond so long as there are other things to do... looks like all this is in the same thread, maybe you can do your process in a separate thread?
-
Johan Hakkesteegt wrote:
I have an app that retrieves and calculates a lot of data. The whole process may take about 20 minutes. To prevent the user from thinking that the app has crashed, I added a progress bar, and to give the user a better idea of the progress, I make the form's title bar display a percentage. The problem is that at pretty much any percentage the form no longer updates itself. The application keeps running, no problem, but the progress bar and percentage in the title bar get stuck, which effectively defeats the purpose. Can anyone tell me why this may happen ?
The UI will not respond so long as there are other things to do... looks like all this is in the same thread, maybe you can do your process in a separate thread?
Thanks for the response. The funny thing is though, that it does work for a while. At the moment the UI freezes, the app is retrieving data from a database with a succession of datareaders. In other words it is repeating the same task over and over (with different parameters each time ofcourse). If we consider your theory, why does the UI not freeze right away?
My advice is free, and you may get what you paid for.
-
Thanks for the response. The funny thing is though, that it does work for a while. At the moment the UI freezes, the app is retrieving data from a database with a succession of datareaders. In other words it is repeating the same task over and over (with different parameters each time ofcourse). If we consider your theory, why does the UI not freeze right away?
My advice is free, and you may get what you paid for.
Johan Hakkesteegt wrote:
The funny thing is though, that it does work for a while. At the moment the UI freezes, the app is retrieving data from a database with a succession of datareaders. In other words it is repeating the same task over and over (with different parameters each time ofcourse). If we consider your theory, why does the UI not freeze right away?
Your description of the problem reinforces my theory :) You usually find that the UI becomes unresponsive when there are repetitive tasks...
-
Thanks for the response. The funny thing is though, that it does work for a while. At the moment the UI freezes, the app is retrieving data from a database with a succession of datareaders. In other words it is repeating the same task over and over (with different parameters each time ofcourse). If we consider your theory, why does the UI not freeze right away?
My advice is free, and you may get what you paid for.
The UI thread is busy doing all of your operations. It would appear that every once in a while, the thread is freed to process the Window's message pump, thereby processing all the WM_PAINT messages for the window, which means you get to see your progressbar and window title updates. So long as the thread is busy doing other things, these paint messages do not get processed, thereby looking like the application hung. You have little choice but to move these operations to a seperate thread and have this processing code fire off progress messages every once in a while. The UI thread will be able to process these messages immediately, while your processing thread does it's job. You may want to look into using the BackgroundWorker class make this process easier.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008