Update progress bar from for loop

c#, progress-bar, winforms

Solution

You should use BackgroundWorker combined with a ProgressBar control. Here is a simple example.

Problem

I am processing some xml files in for loop and according to the number of files has been processed I want to show the progress bar. Suppose there are 100 files in directory and files are processing one by one in loop and I want to update the progress bar according to the current count of the for loop. Please suggest..

Original source

Related problems