我有这个错误:跨线程操作无效:“控制'progressBar1'从创建它的线程以外的线程访问。” 我似乎无法弄清楚如何解决它。
private void button1_Click(object sender, EventArgs e)
{
this.panel1.Visible = false;
this.panel2.Visible = true;
new Thread(ProgressBAR).Start();
}
private void ProgressBAR()
{
Thread.Sleep(5);
for (int start = 0; start <= 100; start++)
{
this.progressBar1.Value = start;
Thread.Sleep(5);
}
}