HeaderPane
Main
Hide
Share Link
Print

CustomValidation Event, SftMask Object

Valid input is detected (custom application validation).

Syntax

C#void object_CustomValidation(object sender, EventArgumentType e);
VB.NETPrivate Sub object_CustomValidation(ByVal sender As Object, ByVal e As EventArgumentType) Handles object.CustomValidation
C++void OnCustomValidationobject(VARIANT_BOOL* Cancel);
CHRESULT OnCustomValidationobject(VARIANT_BOOL* Cancel);

object

A SftMask object.

Cancel

A Boolean value. If True is returned, the contents are considered invalid and the ValidationError event occurs. If False is returned, the contents are considered valid. The default is False.

Comments

The CustomValidation event occurs when valid input is detected (custom application validation).

The CustomValidation event occurs whenever the control loses the input focus or the Contents.Valid and ValidMsg properties are used and the contents are valid (based on the Mask property).

This event allows the application to implement additional data validation, beyond the validation offered by the Mask property.

If the current input in the Masked Edit control is considered valid (based on the Mask property), the CustomValidation event occurs. The application can perform further validation and accept or reject the current contents.

Even though the contents are always considered valid in a simple edit control, the CustomValidation event still occurs.

Examples

VB.NET View entire sample code

                axSftMaskAmount.Contents.Valid Then
            ' save the data
            Application.Exit() '  and exit
        Else
            MessageBox.Show("There are validation errors - Please correct the data entered.")
        End If
    End Sub

    Private Sub axSftMaskZIP_CustomValidation(ByVal sender As Object, ByVal e As AxSftMaskLib80._ISftMaskEvents_CustomValidationEvent) Handles axSftMaskZIP.CustomValidation
        If axSftMaskZIP.Text <> "11111" Then
            e.cancel = True
        End If
    End Sub
End Class

C++ View entire sample code

//  the minimized window.
HCURSOR CSample4Dlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

BEGIN_EVENTSINK_MAP(CSample4Dlg, CDialog)
    //{{AFX_EVENTSINK_MAP(CSample4Dlg)
	ON_EVENT(CSample4Dlg, IDC_SFTMASKZIP, 9 /* CustomValidation */, OnCustomValidationSftMaskZip, VTS_PBOOL)
	//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()

void CSample4Dlg::OnCustomValidationSftMaskZip(BOOL FAR* Cancel) 
{
    if (m_vSftMaskZIP->Text != _bstr_t("11111")) {
        *Cancel = TRUE;

See Also SftMask Events | Object Hierarchy


Last Updated 11/15/2026 - (email)
© 2026 Softel vdm, Inc.