471,350 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

DialogResult of a MessageBox when the close button is clicked

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.

Dec 27 '05 #1
2 3996
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.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"David" <th*****@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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.

Dec 27 '05 #2
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.

Dec 27 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Cantekin Guneser | last post: by
8 posts views Thread by Don | last post: by
20 posts views Thread by Peter E. Granger | last post: by
7 posts views Thread by Frank Maxey | last post: by
1 post views Thread by Bill Cart | last post: by
2 posts views Thread by WP | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.