Valid input is detected (custom application validation).
| C# | void object_CustomValidation(object sender, EventArgumentType e); |
| VB.NET | Private Sub object_CustomValidation(ByVal sender As Object, ByVal e As EventArgumentType) Handles object.CustomValidation |
| C++ | void OnCustomValidationobject(VARIANT_BOOL* Cancel); |
| C | HRESULT OnCustomValidationobject(VARIANT_BOOL* Cancel); |
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.
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.
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
// 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