DialogResult of a MessageBox when the close button is clicked

  • Thread starter Thread starter David
  • Start date Start date
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.
 
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.
 
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.
 
Back
Top