Cancel click event on ShowDialog form
I am displaying a form with xForm.ShowDialog(this);
.
This form has a button that is DialogResult
set to OK. Now when I click OK, some validation is done. If that fails, I want the form to stay that way, but the form closes and returns DialogResult.OK
to the main form. So how can I prevent this?
For instance,
Button_click
{
If validation fails pretend we never came here
else some code.. return DialogResult.OK
}
0
a source to share