When my application starts, and it has just been upgraded, I am doing a local database update (sqlite).
It is like that: The user starts my app, and then I start th
I understand your desire to make the progressbar the background thread, but I am fairly certain that you will not be able to do this. Because you want to update the visual components of your application, the UI needs to be the primary thread. It is easy enough to disable all of the controls on a form, including menu items.
Let me suggest this process:
Show your form with the progressbar mentioned.
If you show any other forms, disable all child controls that are directly on the form. Depending on the control, you may have to walk through its child controls to disable them.
In the code that performs the database update, update the progressbar's value to what ever value you desire. Upon updating the value, call the progressbar's refresh method. This will force the progressbar to paint correctly.
Once your update completes, hide the progressbar, re-enable all of the controls on all of the forms that you disabled.
This will give you the appearance of a progressbar that is running in the background thread while still giving your application the blocking of the main thread as desired.