HeaderPane
Main
Hide
Share Link
Print

ValidationError Event, SftMask Class

Occurs when the validation finds that the contents are not valid.

Class: SftMask
Namespace: Softelvdm.SftMaskNET
Assembly: Softelvdm.SftMaskNET

Syntax

public event EventHandler<ValidationErrorEventArgs> ValidationError;
Public Event ValidationError As EventHandler(Of ValidationErrorEventArgs)

Comments

Occurs when the validation finds that the contents are not valid.

Examples

C# View entire sample code

            DumpValues("sftMask1.ValueChanged (" + (sftMask1.Value.HasValue ? sftMask1.Value.Value.ToString() : "none") + ")", e);
        }

        private void sftMask1_InputRejected(object sender, InputRejectedEventArgs e) {
            DumpValues("sftMask1.InputRejected", e);
        }

        private void sftMask1_ValidationError(object sender, ValidationErrorEventArgs e) {
            DumpValues("sftMask1.ValidationError", e);
        }

        // Amounts over 10,000 are not accepted.
        private void sftMask1_CustomValidation(object sender, CancelEventArgs e) {
            e.Cancel = sftMask1.Value.HasValue && sftMask1.Value.Value > 10000;
            DumpValues("sftMask1.CustomValidation" + (e.Cancel ? " (over 10,000, refused)" : ""), e);
        }

VB.NET View entire sample code

        End If
        DumpValues("SftMask1.ValueChanged (" + value + ")", e)
    End Sub

    Private Sub SftMask1_InputRejected(ByVal sender As Object, ByVal e As InputRejectedEventArgs) Handles SftMask1.InputRejected
        DumpValues("SftMask1.InputRejected", e)
    End Sub

    Private Sub SftMask1_ValidationError(ByVal sender As Object, ByVal e As ValidationErrorEventArgs) Handles SftMask1.ValidationError
        DumpValues("SftMask1.ValidationError", e)
    End Sub

    ' Amounts over 10,000 are not accepted.
    Private Sub SftMask1_CustomValidation(ByVal sender As Object, ByVal e As CancelEventArgs) Handles SftMask1.CustomValidation
        e.Cancel = SftMask1.Value.HasValue AndAlso SftMask1.Value.Value > 10000
        DumpValues("SftMask1.CustomValidation" + If(e.Cancel, " (over 10,000, refused)", ""), e)

See Also SftMask Class | Classes | SftMask/NET 3.0