Further Details on Vallidating Event not Working....

Posted by Sameep on Stack Overflow See other posts from Stack Overflow or by Sameep
Published on 2009-12-09T11:46:12Z Indexed on 2010/06/03 13:34 UTC
Read the original article Hit count: 140

Filed under:
|
|
|

I have created a custom control that inherit the TextBox, in that control i have override validating event and in validating event i have put validation that checks for the empty field.

Now when i use that control on my winform and when i click on save button it immediate fires save event.. the validation event of custom control fires and it displays the error message but still it does not stop the save event to fire....

the save button CauseValidation Property is set to true..

i have also put (this.ValidateChildren())

i have also put CancelEventArgs ce.Cancel = true; in Custom Textbox control

but neither working to stop the save event to fires..

i only want to fire Save event if Textbox is not empty.

validating event fires, shows message for empty field and immediate fires save event..

now if you got an idea then if you have solution then please provide solution..

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET