HeaderPane
Main
Hide
Share Link
Print

CustomValidation Event, SftMask Class

Occurs when the contents are validated, after the mask's own checks passed; setting Cancel makes them not valid.

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

Syntax

public event CancelEventHandler CustomValidation;
Public Event CustomValidation As CancelEventHandler

Comments

Occurs when the contents are validated, after the mask's own checks passed; setting Cancel makes them not valid.

Examples

C# View entire sample code

        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);
        }

        private void sftMask1_UpDownPress(object sender, UpDownPressEventArgs e) {
            DumpValues("sftMask1.UpDownPress", e);
        }

        private void sftMask1_CalculatorOpening(object sender, CalculatorOpeningEventArgs e) {
            e.Cancel = checkBlock.Checked;

VB.NET View entire sample code

        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)
    End Sub

    Private Sub SftMask1_UpDownPress(ByVal sender As Object, ByVal e As UpDownPressEventArgs) Handles SftMask1.UpDownPress
        DumpValues("SftMask1.UpDownPress", e)
    End Sub

See Also SftMask Class | Classes | SftMask/NET 3.0