raisin_smiles
2009-08-21 06:21:25 UTC
I'm quite the newbie and read about background workers and implemented one for the combobox but soon realised that the actual update of the combobox could not be done in the background worker only when it had completed as nothing done in the backgroundwork could manipulate controls on the form.
I then had the idea to launch another form on top with a progress bar (Which reads a textfile line by line and utilises the Application.DoEvents in the loop which reads the data into a string array), populating the combobox in the parent form from the child form, disabling the main form.
Then once the data had been loaded, close the form and re-enable the main form.
This worked well but as the form contains tabcontrol when the tabpage is accessed which contains the combobox there is a 2-3 second delay for the first time only.
What solutions are there to handle such an event of populating combobox with 30K items whilst allowing the user to still interact with the main form?
I'm currently reading more about threading, easier threading maintenance with the backgroundworker and application.DoEvents.
Thanks
Rob