Hide

SftMask/OCX 7.0 - ActiveX Masked Edit Control

Display
Print

Sample4 Sample (C#)

This sample illustrates input validation.

The source code is located at C:\Program Files (x86)\Softelvdm\SftMask OCX 7.0\Samples\Visual Studio - CSharp\Sample4\Form1.cs or C:\Program Files\Softelvdm\SftMask OCX 7.0\Samples\Visual Studio - CSharp\Sample4\Form1.cs (on 32-bit Windows versions).

private void buttonOK_Click(object sender, EventArgs e)
{
    if (axSftMaskName.Contents.Valid &
            axSftMaskCompany.Contents.Valid &
            axSftMaskZIP.Contents.Valid &
            axSftMaskTelephone.Contents.Valid &
            axSftMaskDate.Contents.Valid &
            axSftMaskAmount.Contents.Valid) {
        // save the data
        Application.Exit(); //  and exit
    } else {
        MessageBox.Show("There are validation errors - Please correct the data entered.");
    }
}

private void axSftMaskZIP_CustomValidation(object sender, AxSftMaskLib70._ISftMaskEvents_CustomValidationEvent e)
{
    if (axSftMaskZIP.Text != "11111") {
        e.cancel = true;
    }
}

Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.