HeaderPane
Main
Hide
Share Link
Print

Input Validation

Input validation is an important part of any application as data entered by the user must be verified and validated. SftMask/OCX has a number of features designed to assist an application to validate input data.

Generally, a suitable input mask is defined using the Mask property. Optionally, the MessageEmpty and MessageInvalid properties can be defined to provide error messages. SftMask/OCX will never automatically display an error message.

An application can use the Contents.Valid property to determine if a control's input data is valid. If the equivalent ValidMsg property is used instead, a suitable error message is displayed (based on the MessageEmpty and MessageInvalid properties).

The ValidationError event occurs when various error conditions are detected.

An application must explicitly call the Contents.Valid (or ValidMsg) property to ensure that the input is valid and display an error message if necessary. It is strongly discouraged to implement this in an event such as LostFocus, WM_KILLFOCUS, FocusOut, etc. as this would prevent a user from clicking on a Cancel button, closing the window, etc. unless valid input is entered first. Validation of input data should typically take place in response to the user clicking on an OK, Apply or Save button.


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