private void button1_Click(object sender, EventArgs e)
{
PROGRESS_BAR.Minimum = 0;
PROGRESS_BAR.Maximum = 100;
PROGRESS_BAR.Value = 0;
You should use the BackgroundWorker component and its ProgressChanged
event.
You can call the ReportProgress
method inside the DoWork
handler (which runs on the background thread), then update the progress bar in the ProgressChanged
handler (which runs on the UI thread).
If you really want to do it yourself (without a BackgroundWorker), you can call BeginInvoke