Force to close MessageBox programmatically

后端 未结 11 2120
清酒与你
清酒与你 2020-12-03 07:21

Let me give you the background.

We have an Application(medium sized) that is using MessageBox.Show (....) at various places (in hundreds).

These message bo

11条回答
  •  无人及你
    2020-12-03 08:24

    Taking as an assumption that you can edit the code that's calling the MessageBox.Show() method, I would recommend not use MessageBox. Instead, just use your own custom form, calling ShowDialog() on it to do basically the same thing as the MessageBox class. Then, you have the instance of the form itself, and you can call Close() on that instance to close it.

    A good example is here.

提交回复
热议问题