C# Label Text Not Updating

前端 未结 7 1837
無奈伤痛
無奈伤痛 2021-01-04 06:16

I have the following code:

private void button1_Click(object sender, EventArgs e)
{
  var answer =
    MessageBox.Show(
      \"Do you wish to submit checked         


        
7条回答
  •  遥遥无期
    2021-01-04 06:55

    You're performing a lengthy operation on the UI thread. You should move it to a background thread (via BackgroundWorker for instance) so the UI thread can do things like repaint the screen when needed. You can cheat and execute Application.DoEvents, but I'd really recommend against it.

    This question and answer are basically what you're asking:
    Form Not Responding when any other operation performed in C#

提交回复
热议问题