This sample illustrates input validation.
The source code is located at C:\Program Files (x86)\Softelvdm\SftMask OCX 7.0\Samples\VB6\Sample4\Form1.frm or C:\Program Files\Softelvdm\SftMask OCX 7.0\Samples\VB6\Sample4\\VB6\ (on 32-bit Windows versions).
Option Explicit
Private Sub buttonSave_Click()
If SftMaskName.Contents.Valid And _
SftMaskCompany.Contents.Valid And _
SftMaskZIP.Contents.Valid And _
SftMaskTelephone.Contents.Valid And _
SftMaskDate.Contents.Valid And _
SftMaskAmount.Contents.Valid Then
' save the data
End ' and exit
Else
MsgBox ("There are validation errors - Please correct the data entered.")
End If
End Sub
Private Sub SftMaskZIP_CustomValidation(Cancel As Boolean)
'To demonstrate custom validation, this sample application only accepts the ZIP Code 11111.
If SftMaskZIP.Text <> "11111" Then
Cancel = True
End If
End Sub