property MaskEdit.ValidateAs as ValidateAsEnum
Indicates the additional validation is performed, once the user leaves the field.

TypeDescription
ValidateAsEnum A ValidateAsEnum expression that specifies the type of validation it should be performed once the field is completed.  
By default, the ValidateAs property is exValidateAsNone, so no further validation is performed. For instance, you can use the ValidateAs property to validate a valid date your user enters in the field. This property has effect only if the Invalid property is not empty. The Invalid property is not empty, indicates the html message to be displayed when the user enters an inappropriate value for the field. If the value is missing or empty, the option has no effect, so no validation is performed. If the value is a not-empty value, the validation is performed. If the value is single space, no message is displayed and the field is keep opened while the value is inappropriate. For instance, "!(999) 000 0000;;;invalid=The value you entered isn't appropriate for the input mask <b>'<%mask%>'</b> specified for this field." displays the "The value you entered isn't appropriate for the input mask '...' specified for this field." tooltip once the user leaves the field and it is not-valid ( for instance, the field includes entities required and uncompleted ). The <%mask%> keyword in value, substitute the current mask of the field, while the <%value%> keyword substitutes the current value ( including the literals ). If this option should display/use the semicolon (;) character is should be \; ( escape ). This option can be combined with empty, validateas. 

The following samples validates the field as a date:

VBA (MS Access, Excell...)

With MaskEdit1
	.SelectGotFocus = 4
	.Mask = "!99/99/9999;; ;select=4,overtype"
	.Text = #1/2/2001#
	.Warning = "Invalid character!"
	.Invalid = "Invalid date!"
	.ValidateAs = 1
	.AllowEmptyValue = True
End With

VB6

With MaskEdit1
	.SelectGotFocus = exSelectRequiredEditableGotFocus
	.Mask = "!99/99/9999;; ;select=4,overtype"
	.Text = #1/2/2001#
	.Warning = "Invalid character!"
	.Invalid = "Invalid date!"
	.ValidateAs = exValidateAsDate
	.AllowEmptyValue = True
End With

VB.NET

With Exmaskedit1
	.SelectGotFocus = exontrol.EXMASKEDITLib.SelectGotFocusEnum.exSelectRequiredEditableGotFocus
	.Mask = "!99/99/9999;; ;select=4,overtype"
	.Text = #1/2/2001#
	.Warning = "Invalid character!"
	.Invalid = "Invalid date!"
	.ValidateAs = exontrol.EXMASKEDITLib.ValidateAsEnum.exValidateAsDate
	.AllowEmptyValue = True
End With

VB.NET for /COM

With AxMaskEdit1
	.SelectGotFocus = EXMASKEDITLib.SelectGotFocusEnum.exSelectRequiredEditableGotFocus
	.Mask = "!99/99/9999;; ;select=4,overtype"
	.Text = #1/2/2001#
	.Warning = "Invalid character!"
	.Invalid = "Invalid date!"
	.ValidateAs = EXMASKEDITLib.ValidateAsEnum.exValidateAsDate
	.AllowEmptyValue = True
End With

C++

/*
	Copy and paste the following directives to your header file as
	it defines the namespace 'EXMASKEDITLib' for the library: 'ExMaskEdit 7.1 Control Library'

	#import <MaskEdit.dll>
	using namespace EXMASKEDITLib;
*/
EXMASKEDITLib::IMaskEditPtr spMaskEdit1 = GetDlgItem(IDC_MASKEDIT1)->GetControlUnknown();
spMaskEdit1->PutSelectGotFocus(EXMASKEDITLib::exSelectRequiredEditableGotFocus);
spMaskEdit1->PutMask(L"!99/99/9999;; ;select=4,overtype");
spMaskEdit1->PutText(L"1/2/2001");
spMaskEdit1->PutWarning(L"Invalid character!");
spMaskEdit1->PutInvalid(L"Invalid date!");
spMaskEdit1->PutValidateAs(EXMASKEDITLib::exValidateAsDate);
spMaskEdit1->PutAllowEmptyValue(VARIANT_TRUE);

C++ Builder

MaskEdit1->SelectGotFocus = Exmaskeditlib_tlb::SelectGotFocusEnum::exSelectRequiredEditableGotFocus;
MaskEdit1->Mask = L"!99/99/9999;; ;select=4,overtype";
MaskEdit1->Text = L"TDateTime(2001,1,2).operator double()";
MaskEdit1->Warning = L"Invalid character!";
MaskEdit1->Invalid = L"Invalid date!";
MaskEdit1->ValidateAs = Exmaskeditlib_tlb::ValidateAsEnum::exValidateAsDate;
MaskEdit1->AllowEmptyValue = true;

C#

exmaskedit1.SelectGotFocus = exontrol.EXMASKEDITLib.SelectGotFocusEnum.exSelectRequiredEditableGotFocus;
exmaskedit1.Mask = "!99/99/9999;; ;select=4,overtype";
exmaskedit1.Text = Convert.ToDateTime("1/2/2001",System.Globalization.CultureInfo.GetCultureInfo("en-US")).ToString();
exmaskedit1.Warning = "Invalid character!";
exmaskedit1.Invalid = "Invalid date!";
exmaskedit1.ValidateAs = exontrol.EXMASKEDITLib.ValidateAsEnum.exValidateAsDate;
exmaskedit1.AllowEmptyValue = true;

JavaScript

<OBJECT classid="clsid:43F80262-F652-11D3-AD39-00C0DFC59237" id="MaskEdit1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
	MaskEdit1.SelectGotFocus = 4;
	MaskEdit1.Mask = "!99/99/9999;; ;select=4,overtype";
	MaskEdit1.Text = "1/2/2001";
	MaskEdit1.Warning = "Invalid character!";
	MaskEdit1.Invalid = "Invalid date!";
	MaskEdit1.ValidateAs = 1;
	MaskEdit1.AllowEmptyValue = true;
</SCRIPT>

C# for /COM

axMaskEdit1.SelectGotFocus = EXMASKEDITLib.SelectGotFocusEnum.exSelectRequiredEditableGotFocus;
axMaskEdit1.Mask = "!99/99/9999;; ;select=4,overtype";
axMaskEdit1.Text = Convert.ToDateTime("1/2/2001",System.Globalization.CultureInfo.GetCultureInfo("en-US")).ToString();
axMaskEdit1.Warning = "Invalid character!";
axMaskEdit1.Invalid = "Invalid date!";
axMaskEdit1.ValidateAs = EXMASKEDITLib.ValidateAsEnum.exValidateAsDate;
axMaskEdit1.AllowEmptyValue = true;

X++ (Dynamics Ax 2009)

public void init()
{
	;

	super();

	exmaskedit1.SelectGotFocus(4/*exSelectRequiredEditableGotFocus*/);
	exmaskedit1.Mask("!99/99/9999;; ;select=4,overtype");
	exmaskedit1.Text(str2Date("1/2/2001",213));
	exmaskedit1.Warning("Invalid character!");
	exmaskedit1.Invalid("Invalid date!");
	exmaskedit1.ValidateAs(1/*exValidateAsDate*/);
	exmaskedit1.AllowEmptyValue(true);
}

Delphi 8 (.NET only)

with AxMaskEdit1 do
begin
	SelectGotFocus := EXMASKEDITLib.SelectGotFocusEnum.exSelectRequiredEditableGotFocus;
	Mask := '!99/99/9999;; ;select=4,overtype';
	Text := '1/2/2001';
	Warning := 'Invalid character!';
	Invalid := 'Invalid date!';
	ValidateAs := EXMASKEDITLib.ValidateAsEnum.exValidateAsDate;
	AllowEmptyValue := True;
end

Delphi (standard)

with MaskEdit1 do
begin
	SelectGotFocus := EXMASKEDITLib_TLB.exSelectRequiredEditableGotFocus;
	Mask := '!99/99/9999;; ;select=4,overtype';
	Text := '1/2/2001';
	Warning := 'Invalid character!';
	Invalid := 'Invalid date!';
	ValidateAs := EXMASKEDITLib_TLB.exValidateAsDate;
	AllowEmptyValue := True;
end

VFP

with thisform.MaskEdit1
	.SelectGotFocus = 4
	.Mask = "!99/99/9999;; ;select=4,overtype"
	.Text = {^2001-1-2}
	.Warning = "Invalid character!"
	.Invalid = "Invalid date!"
	.ValidateAs = 1
	.AllowEmptyValue = .T.
endwith

dBASE Plus

local oMaskEdit

oMaskEdit = form.Activex1.nativeObject
oMaskEdit.SelectGotFocus = 4
oMaskEdit.Mask = "!99/99/9999;; ;select=4,overtype"
oMaskEdit.Text = Str("01/02/2001")
oMaskEdit.Warning = "Invalid character!"
oMaskEdit.Invalid = "Invalid date!"
oMaskEdit.ValidateAs = 1
oMaskEdit.AllowEmptyValue = true

XBasic (Alpha Five)

Dim oMaskEdit as P

oMaskEdit = topparent:CONTROL_ACTIVEX1.activex
oMaskEdit.SelectGotFocus = 4
oMaskEdit.Mask = "!99/99/9999;; ;select=4,overtype"
oMaskEdit.Text = {01/02/2001}
oMaskEdit.Warning = "Invalid character!"
oMaskEdit.Invalid = "Invalid date!"
oMaskEdit.ValidateAs = 1
oMaskEdit.AllowEmptyValue = .t.

Visual Objects


oDCOCX_Exontrol1:SelectGotFocus := exSelectRequiredEditableGotFocus
oDCOCX_Exontrol1:Mask := "!99/99/9999;; ;select=4,overtype"
oDCOCX_Exontrol1:Text := AsString(SToD("20010102"))
oDCOCX_Exontrol1:Warning := "Invalid character!"
oDCOCX_Exontrol1:Invalid := "Invalid date!"
oDCOCX_Exontrol1:ValidateAs := exValidateAsDate
oDCOCX_Exontrol1:AllowEmptyValue := true

PowerBuilder

OleObject oMaskEdit

oMaskEdit = ole_1.Object
oMaskEdit.SelectGotFocus = 4
oMaskEdit.Mask = "!99/99/9999;; ;select=4,overtype"
oMaskEdit.Text = String(2001-01-02)
oMaskEdit.Warning = "Invalid character!"
oMaskEdit.Invalid = "Invalid date!"
oMaskEdit.ValidateAs = 1
oMaskEdit.AllowEmptyValue = true

Visual DataFlex

Procedure OnCreate
	Forward Send OnCreate
	Set ComSelectGotFocus to OLEexSelectRequiredEditableGotFocus
	Set ComMask to "!99/99/9999;; ;select=4,overtype"
	Set ComText to "1/2/2001"
	Set ComWarning to "Invalid character!"
	Set ComInvalid to "Invalid date!"
	Set ComValidateAs to OLEexValidateAsDate
	Set ComAllowEmptyValue to True
End_Procedure