Zeebo Khan Zeebo Khan - 1 year ago 86
C# Question

What is the exact cause that fires the validating event?

I have searched for the question that when is the validating event fired but the answer I found so far is that when the validation starts.
What I want to know is the actual firing time of the validating event.
For example, the click event is fired when a control is clicked by either mouse or keyboard and similarly leave is fired when a control is no more the current focused control.
So what is the explanation of validating event being fired?

Answer Source

The Validating event is fired only when the control that receives the focus has the CausesValidation property set to true. For example, if you have written code in TextBox's Validating event, and you click the OK button (CausesValidation = true) then the Validating event is raised, but if you click the Cancel button (CausesValidation = false) then the Validating event would not be able to fire.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download