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


           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: [email protected]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [email protected]
          Found By: ---


Summary:
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.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to