我们先来看一段运行时会抛出 InvalidOperationException 异常的代码段:

object sender, EventArgs e)
{
    Thread thread = new Thread(ChangeTextBox);
    thread.IsBackground = true;
    thread.Start();
}
 
void ChangeTextBox()
{
    for (int i = 0; i < 10000; i++)
    {
        int num = Int32.Parse(txtNum.Text);
        num++;
        txtNum.Text = num.ToString();
    }
}

相关文章:

  • 2021-10-14
  • 2021-06-20
  • 2022-02-02
  • 2022-12-23
  • 2021-11-28
  • 2021-11-10
  • 2021-07-10
  • 2022-01-22
猜你喜欢
  • 2022-01-26
  • 2022-02-26
  • 2021-08-20
  • 2022-02-11
  • 2021-06-02
相关资源
相似解决方案