[Mono-bugs] [Bug 330501] Control: OnValidating method not called on form close

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Jan 11 14:21:17 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=330501

User sbrooks at quantussoftware.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=330501#c2


Steven Brooks <sbrooks at quantussoftware.com> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
                 CC|                                                |sbrooks at quantussoftware.com




--- Comment #2 from Steven Brooks <sbrooks at quantussoftware.com>  2008-01-11 12:21:16 MST ---
This is how .NET behaves, but this "feature" is sometimes annoying; would it be
possible to implement it in a way that this workaround still works?

    Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
        ' Prevent the Windows' close button and Alt+F4 from validating fields
        If m.Msg = &H112 And m.WParam = &HF060 Then ' WM_SYSCOMMAND, SC_CLOSE
            Dim cancel As New
System.Windows.Forms.FormClosingEventArgs(CloseReason.UserClosing, False)
            OnFormClosing(cancel)
            If Not cancel.Cancel Then
                Dispose() ' Does not validate fields
            End If
        Else
            MyBase.WndProc(m)
        End If
    End Sub


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list