I have an application that loads many controls and data on startup. This takes a little while so I decided to implement a progress bar. Idealy i would use a backgroundworker to perform the work and report progress, but controls I create in this thread will not be usable on the host form due to being created on a different thread. This raises two questions:
1: why are controls locked to the thread they were created on?. and
2: how could i transfer ownership from the background thread to the main application thread?
Try just using the background thread for a small ShowProgress class that includes the progress bar control. Don't include the making of anything in that thread. Its only purpose is to show the progress status.
Use an event in your control creation thread that occurs when something significant happens (like 10 more controls are added)
Have the progress bar class/thread subscribe to the the custom event. So when ever the event fires, the progress bar will update/step.
Of course you'll have to give it a couple properties like Minimum and Maximum so it can calculate how much is left etc.