C validating canceleventargs
Cancel property - just like we can set that property for the Form Closing event. Whatever code is actually instantiating your args class would check the flag after calling the method that raises the event, and the flag will be set if any of the code dealing with the event sets it.
Pete In consideration of the brief sample code at the following link... Cancel = true, How does the form subsequently know to NOT close the form?
Note also that the user can leave a field if it doesn’t have a This entry was posted in controls and tagged C#, C# programming, controls, example, example program, validate field, validate form, Validating event, Windows Forms programming.
That, plus I had some presumption - don't ask why - that the event handler delegates were invoking their referenced event handling methods asynchronously. That _would_ however make a difference in terms of the timing involved in the publisher giving any/all subscribers a chance to set the value of .
Cancel, with the subscriber needing block until any/all subscribers returned.
intercepting form's closing handling can cancel validation before first event fires requires hack.
The event handler receives an argument of type System. Cancel Event Args containing data related to this event.