Can MessageBox.Show cause cross-thread exceptions?

前端 未结 3 1910
独厮守ぢ
独厮守ぢ 2021-01-06 03:46

Can I call MessageBox.Show on a child thread without worrying about a cross-thread exception? I know the ostensible answer would be \"try it and find out\", wh

3条回答
  •  天命终不由人
    2021-01-06 04:36

    You are safe to throw a MessageBox in a separate thread. But keep in mind that it will only block the thread that it was created on. If you are using a WinForm app and another thread calls the MessageBox then the form is still able to be played around with and the user can ignore it.

提交回复
热议问题