A
Arun Kumar
What is wrong with this code. All i am trying to test is 3 progressbar and
one button. On buttonclick i create 3 threads and each thread calls a method
which in turn updates the progressbar and it works. I would to know if this
can be used.
Thanks
private void button1_Click(object sender, System.EventArgs e)
{
ThreadStart job = new ThreadStart(onemethod);
Thread thread = new Thread(job);
thread.Start();
ThreadStart job1 = new ThreadStart(secondmethod);
Thread thread1 = new Thread(job1);
thread1.Start();
ThreadStart job2 = new ThreadStart(thirdmethod);
Thread thread2 = new Thread(job2);
thread2.Start();
}
public void onemethod()
{
for (int i=0;i<100;i++)
{
progressBar1.Value = i;
Thread.Sleep(100);
}
}
public void secondmethod()
{
for (int i=0;i<100;i++)
{
progressBar2.Value = i;
Thread.Sleep(100);
}
}
public void thirdmethod()
{
for (int i=0;i<100;i++)
{
progressBar3.Value = i;
Thread.Sleep(100);
}
}
one button. On buttonclick i create 3 threads and each thread calls a method
which in turn updates the progressbar and it works. I would to know if this
can be used.
Thanks
private void button1_Click(object sender, System.EventArgs e)
{
ThreadStart job = new ThreadStart(onemethod);
Thread thread = new Thread(job);
thread.Start();
ThreadStart job1 = new ThreadStart(secondmethod);
Thread thread1 = new Thread(job1);
thread1.Start();
ThreadStart job2 = new ThreadStart(thirdmethod);
Thread thread2 = new Thread(job2);
thread2.Start();
}
public void onemethod()
{
for (int i=0;i<100;i++)
{
progressBar1.Value = i;
Thread.Sleep(100);
}
}
public void secondmethod()
{
for (int i=0;i<100;i++)
{
progressBar2.Value = i;
Thread.Sleep(100);
}
}
public void thirdmethod()
{
for (int i=0;i<100;i++)
{
progressBar3.Value = i;
Thread.Sleep(100);
}
}