Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update progress bar from for loop [duplicate]

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..

like image 283
nitendra jain Avatar asked Sep 27 '12 09:09

nitendra jain


2 Answers

Process the 100 files using a Background Worker, call ReportProgress every iteration, hook on to the Process changed event of the backgroundworker and update a progressbar accordingly.

You can check out this tutorial for details.

like image 180
zeebonk Avatar answered Nov 02 '22 22:11

zeebonk


Take a look at BackgroundWorker class, particularly, at ProgressChanged event.

like image 40
Dennis Avatar answered Nov 03 '22 00:11

Dennis