C# Validate before leaving accept_button event
Excuse me if this is a silly question but i'm a beginer here.

I have a simply custom dialog with two buttons: Accept and Cancel. The Accept button is the acceptButton of the form.

I want to do some validations on the Accept_Click event and decide if i can close the dialog or not, but everytime it leaves this method, the dialog automatically closes itself and returns Ok.

How can i do to stop the dialog from closing itself? or i have to do things in some other way?

thanks
C# Validate before leaving accept_button event
===

Excuse me if this is a silly question but i'm a beginer here.

I have a simply custom dialog with two buttons: Accept and Cancel. The Accept button is the acceptButton of the form.

I want to do some validations on the Accept_Click event and decide if i can close the dialog or not, but everytime it leaves this method, the dialog automatically closes itself and returns Ok.

How can i do to stop the dialog from closing itself? or i have to do things in some other way?

thanks