Here is an example of a custom validation for Windows devices. This code uses a Field named "Date" to validate a specially formatted date.


<MiCode(ControlScriptEventType.AfterSetData, "Date")> _
Public Sub Ctl_Date_AfterSetData(ByVal e As AfterSetDataEventArgs)
	Dim bRes As Boolean = (_Date.DateTimeValue > DateTime.MinValue) And (_Date.DateTimeValue < DateTime.MaxValue)
	Me.Validate("Date_Check", bRes, "Short Description", "Long Description", "Date", False) 
	_Date.HighlightRectangleColor = System.Drawing.Color.FromArgb(-16744193)
	_Date.Highlight = Not bRes
End Sub


This control makes sure that the date is in a range of all legally formatted dates.