A
Andrew
- There is a form, which contains a user control.
- This control contains another control.
- The OnValidating method of the second control is
overridden. So there are some situations when control is
not valid:
protected override void OnValidating( CancelEventArgs e )
{
if ( ... )
{
e.Cancel = true;
MessageBox.Show( "Validation error!" );
}
base.OnValidating( e );
}
- But when user tries to close the form, it closes after
showing message box. This is not correct. The form
shouldn't be closed. Is this a framework bug?
Thank you.
- This control contains another control.
- The OnValidating method of the second control is
overridden. So there are some situations when control is
not valid:
protected override void OnValidating( CancelEventArgs e )
{
if ( ... )
{
e.Cancel = true;
MessageBox.Show( "Validation error!" );
}
base.OnValidating( e );
}
- But when user tries to close the form, it closes after
showing message box. This is not correct. The form
shouldn't be closed. Is this a framework bug?
Thank you.