[Mono-bugs] [Bug 353310] New: Button Clicked event fires even if another control' s Validation fails

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Jan 11 12:31:29 EST 2008


           Summary: Button Clicked event fires even if another control's
                    Validation fails
           Product: Mono: Class Libraries
           Version: 1.2.6
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: sbrooks at quantussoftware.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

User can click a button even if a control's Validation event fails

To Reproduce:
(See code below)
1. Create a form with a textbox and a button
2. Make the textbox always fail its validation event
3. Have the button display a message if clicked
4. Run the form
5. Make sure the focus is in the textbox
6. Click the button

Expected Behaviour (tested with Visual Studio.NET 2008):
Nothing happens (focus does not change, no message is displayed); i.e. button
Clicked event does not occur

Actual Behaviour:
Message is shown

Sample Code (VB.Net):

''' <summary>
'''  Test program because Mono allows you to click a button even if a
validating event fails
''' </summary>
Public Class MonoButtonValidation

    Private Sub TextBox1_Validating(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating
        ' Always fail validation 
        e.Cancel = True
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
        ' With Visual Studio.NET 2008, this will never be called, because
TextBox1 did
        '  not validate
        MessageBox.Show(Me, "Button clicked!")
    End Sub

    Private Sub MonoButtonValidation_FormClosing(ByVal sender As Object, ByVal
e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        ' Allow form to close, despite validate event
        e.Cancel = False
    End Sub
End Class

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

More information about the mono-bugs mailing list