المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Threading



C# Programming
02-11-2010, 05:00 PM
Hi Guys. I have a slight problem. I have written an app that processes various types of files. I create a Thread for each type of file being processed depending on a checkbox being checked.

Now, from each file processed I output totals to a label on the form. However, this only seems to work for the first two files being processed and the remainder does not get their totals output to the labels. Is this a known issue and is there a way I can get around this? The code is kinda long so don't really want to add any here now. But the process flow of the program is such.

1) User selects a searches for file to process.
2) User checks the appropriate checkbox.
3) Thread is started calling the block of code to run.
4) Once file is processed finalize by calling GC.Collect().

if user wants to process another file he unchecks the current chechbox, checks a new checkbox and searches for new file and above process is followed calling the appropriate Thread to run.

Can somebody advise why when running more than two "Thread" processes in succession results in the third and fourth not outputting totals to the Label's?Excellence is doing ordinary things extraordinarily well.