Hi all,
New poster here! I'm having some difficulty updating a tabcontrol cross-threads.
The general idea is : the main thread is the owner of the tab control and the form controls. However, due to the vast amount of data to populate listviews within the tabs, I have created a worker thread (an implementation of a BackgroundWorker) to form the data and populate a tabcontrol 'offline', so that it doesn't interfer with (i.e freeze) the UI. Now the problem I get is, that windows controls are passed by ref not value, and therefore when I give the thread a 'copy' of the current control and pass it back, it isn't a copy, it's the actual thing! I'm trying to implement Clone() in ICloneable, but can't seem to get it right. I need to be able to keep the object as a TabControl, but use the ICloneable class to clone it! Any thoughts or ideas? Although I can't provide code, rough outline is :
Main Thread :
Worker Thread declared
TabControl declared.
Worker thread passed TabControl and started.
Worker Thread :
Local Tab control manipulated
MainThread :
When worker complete, copy its local TabControl to the Main Thread TabControl.
Hope this is helpful.
Cheers,
Chris.