user1255410
user1255410

Reputation: 886

Disable closing button on opened modal dialogs Windows Forms C#

Say I open a dialog like this:

        Login login = new Login();
        if(login.ShowDialog(this) != DialogResult.OK)
            Application.Exit();

Now, login form has a close button in the menu by standard, and closing it seem to either return DialogResult.OK or no dialogresult at all and my application continues without repercussions. How to solve that problem?

Upvotes: 0

Views: 1247

Answers (1)

SLaks
SLaks

Reputation: 887195

Set the ControlBox property to false.

Upvotes: 2

Related Questions