Basic Goal is that i have four progress bar and want to run them at once as button is pressed and i donot have to use background worker have to do by this.
var t = new Thread(() =>
{
try
{
}
});
t.SetApartmentState(ApartmentState.STA);
t.Start();
I tried and codded
for (i = 0; i < 4; i++)
{
var t = new Thread(() =>
{
for (double x = 0; x < 10000; x = x + 0.5)
{
progressVal=(int)x;
this.Invoke(new EventHandler(ProgressBar));
Thread.Sleep(2);
}
});
t.SetApartmentState(ApartmentState.STA);
t.Start();
}
private void ProgressBar(object sender, EventArgs e)
{
progressBar1.Value=progressVal;
}
but cannot think of idea how to manuplate other progress bars
I would put the progress bars into an array:
and the
UpdateProgressmethod:This being said, using a BackgroundWorker is far more adapted to your scenario.