Updating text in a form while other tasks are happening
-
When my app starts up it needs to spend a few seconds getting data from a database, and structuring tables etc. The user needs to know something is going on while this happens so I made a simple form that gives some feedback e.g."xxx is now loading". Trouble is, the app is so busy loading the data that it never gets the chance to write the text in the form. The title is there, but little else (until the data has finished loading, when the form is not required any more anyway!) - just empty 'holes' which let the underlying screen show through. There must be a simple solution to this but it eludes me.
-
When my app starts up it needs to spend a few seconds getting data from a database, and structuring tables etc. The user needs to know something is going on while this happens so I made a simple form that gives some feedback e.g."xxx is now loading". Trouble is, the app is so busy loading the data that it never gets the chance to write the text in the form. The title is there, but little else (until the data has finished loading, when the form is not required any more anyway!) - just empty 'holes' which let the underlying screen show through. There must be a simple solution to this but it eludes me.
What is required here is to have the main form perform the tasks while another form on another thread is processing the display. While it sounds complex, we have an article here[^] that will implement everything for you. I like this screen because of the predictive nature of the status bar. The only item I don't like is that it shows no progress the first time it is run unless you prepopulate the registry. If you'd prefer other approaches, do a search from the home page for articles on Splash Screen.
-
What is required here is to have the main form perform the tasks while another form on another thread is processing the display. While it sounds complex, we have an article here[^] that will implement everything for you. I like this screen because of the predictive nature of the status bar. The only item I don't like is that it shows no progress the first time it is run unless you prepopulate the registry. If you'd prefer other approaches, do a search from the home page for articles on Splash Screen.
-
Thanks 'Condor', this is a bit top-heavy in terms of code size (compared with what I was expecting!) but I have to admit the result is very nice. I'll use it.
You're welcome. :-D ______________________________ The Tao gave birth to machine language. Machine language gave birth to the assembler. The assembler gave birth to ten thousand languages. Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao. Beauty exists because we give a name to C#. Bad exists because we give a name to COBOL.