Threads and ProgressBar
-
Hi, my problem comes from the fact that I'm trying to make my progressbar progress while I'm scanning directory files.the awk thing is that my scan function is defined within my datalayer as a dll.I want my progress bar to follow the files processing. I first thought about threads but could'nt move on.probably got allergy for threads.can anybody help? thanks in advance
-
Hi, my problem comes from the fact that I'm trying to make my progressbar progress while I'm scanning directory files.the awk thing is that my scan function is defined within my datalayer as a dll.I want my progress bar to follow the files processing. I first thought about threads but could'nt move on.probably got allergy for threads.can anybody help? thanks in advance
-
Hi, my problem comes from the fact that I'm trying to make my progressbar progress while I'm scanning directory files.the awk thing is that my scan function is defined within my datalayer as a dll.I want my progress bar to follow the files processing. I first thought about threads but could'nt move on.probably got allergy for threads.can anybody help? thanks in advance
Your problem seems to be a perfect candidate for the BackgroundWroker thread control that's newly available in the .NET 2.0 framework. Using this controll is rather pain free. It's literally a matter of a few click to get yourself set up with a background worker thread that is going ot perform the scan in background for you. The way you use this control is you have to provide three functions to handle three events. One is the actual worker function (this will be the function that scans the files). Then There is a function that will be called when the progress changes. And the last one is going to be a function that will be called when the thread ahs finished processing. So in the actual worker function you will need to call the ReportProgress function that will basically marshal your call and eventually fire the second event (the progress changed event) on the appropriate thread. It's that easy. Feel free to google for the BackgroundWorkerThread samples online Good luck Mikk ---- www.muzikstor.com