You can define validation code (check rules) using the same rules as those for defining formulas (using VB .NET). The code defines the value “result”, which can be either True or False. If True, the value is accepted. If False, the modification is blocked and the user has to correct the input until it fits the rules. The application stays in Edit mode until the input is correct.
The following example from the Water utility application assumes that a hydrant has two elevation attributes: ELEVATION is the height of the point where the hydrant is connected to the water network, GROUND_ELEVATION is the height of the hydrant above sea level. This rule ensures that the GROUND_ELEVATION is always higher than the ELEVATION
The form designer is displayed in the right pane. The topics and feature classes are displayed in the form explorer.
In the Validation Code dialog box, enter the validation code. You can double-click the attribute names in the list to insert them into your code.
if {ELEVATION} < {GROUND_ELEVATION} then Result=True Else Result=False End if
Elevation must not be higher than ground elevation!
Click OK to close the Validation Code window.
To see the validation, open the Hydrant feature class form and enter values for ELEVATION and GROUND_ELEVATION. The error message is displayed if you enter an ELEVATION value that is higher than the GROUND_ELEVATION value.
Control input with a validation code. If the user enters a value that does not match, the specified error message is displayed.