When clicking on a button my program will do the following: The program copies files to a tempfolder and creates a zip file out of the tempfolder. The paths to the files which get copied are stored in an array. Just to make things clear:
// "files" has stored the paths
private void button2_Click(object sender, EventArgs e)
{
foreach (var file in files)
{
File.Copy(file, tempPath + @"\" + System.IO.Path.GetFileName(file));
}
}
I want to include a progressbar into my form which gives feedback about the made progress. For every copied file the progressbar should move.
I am struggleing about how and where to report the progress.
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
int steps = files.Length;
for (int i = 0; i < steps; i++)
{
// Do something...
}
}