Preventing a dialog from closing in the button's click event handler

Posted by qster on Stack Overflow See other posts from Stack Overflow or by qster
Published on 2010-03-23T12:03:05Z Indexed on 2010/03/23 12:13 UTC
Read the original article Hit count: 388

Filed under:
|
|
|

I have a dialog that I show with <class>.ShowDialog(). It has an OK button and a Cancel button; the OK button also has an event handler.

I want to do some input validation in the event handler and, if it fails, notify the user with a message box and prevent the dialog from closing. I don't know how to do the last part (preventing the close).

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET