Click here to Skip to main content
15,906,463 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing a C# windows application. In one form, it has 4 panels(autohide enabled) with grids in it. On load of the form I am filling the grids (As per client's requirement). One grid is having large amount of data and is taking more time to load than expected and the user has to wait all that time. Now, my doubt is, whether I can use multithreading for loading that particular grid??
I heard that using multithread for UI elements is not a good practice. Can anyone give me a suggestion or is there any other option for doing the same??

Thanks in advance
Posted

Yes, you can use multi-threading. The only thing (well, in fact one among many others) that you should take care is not having access to user interface (the form or forms and its controls) from other than the main thread.

Your worker thread could load the data (the supposedly slow part of it) and notify the main thread using one method made adhook. Take a look into the many samples around there about Form.Invoke().
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900