C# / .NET messagebox is not modal
问题 Why is a C#/.NET message box not modal? Accidentally, if the message box goes behind our main UI, then the main UI doesn't respond, until we click OK (on our message box). Is there a workaround other than creating a custom message box? 回答1: You need to assign the MessageBox owner property to the main UI window (look at the 3rd constructor). 回答2: This is a simple C# new Windows Forms application: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data;