This gets asked almost daily so I've written this short demonstration code to demonstrate how to use a
in combination with a
. All the code is commented so the flow/steps should be easy to understand.
Just drop a
) and a
) onto your form and copy and paste this code to see it in action.
public partial class Form1 : Form
Shown += new EventHandler(Form1_Shown);
backgroundWorker1.WorkerReportsProgress = true;
backgroundWorker1.DoWork += new DoWorkEventHandler(backgroundWorker1_DoWork);
backgroundWorker1.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged);
void Form1_Shown(object sender, EventArgs e)
void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
for (int i = 0; i <= 100; i++)
void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
progressBar1.Value = e.ProgressPercentage;
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.