DialogResult of a MessageBox when the close button is clicked

D

David

Is there anyway to get a different DialogResult or detect that the user
clicked the close button on a MessageBox? I have a message box that
pops up when my program first starts that only has an ok button but if
the user clicks the close button the DialogResult is still
DialogResult.OK.
 
N

Nicholas Paldino [.NET/C# MVP]

David,

What would you expect to be sent back to you? Since there is only one
button, you don't give the user much of a choice. If you want them to have
more than one choice, then you should show them more than one button.

That's poor user interface design if you are going to perform a
different action based on them clicking the close button on a dialog that
only has an OK button. It is NOT obvious at all that this would cause a
different action (even if you said so in the dialog).

I would use more than one button, and make a decision on the value
returned, not whether or not the dialog was closed using the close button.

Hope this helps.
 
D

David

I wouldn't expect it to throw an OK result but rather something like
DialogResult.CloseClicked or something to that vein. Much like when
you click a form's close button it doesn't return DialogResult.OK.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top