|
<< Click to Display Table of Contents >>
Validate |
Validate(Cancel, NewValue)
This event occurs after testing the limits of this object and before sending this object's value to a Tag. For more information, please check MinLimit, MaxLimit, and EnableLimits properties. The purpose of this event is allowing users to cancel sending this object's value to a Tag.
The Cancel parameter is a Boolean that indicates if attributing this object's value to a Tag must be canceled (Cancel equal to True). Default is False, that is, this object's value is sent to a Tag. NewValue is the evaluated value. The old value can be accessed in this object's Value property. The next script contains an example of using this event.
Sub Text1_Validate(Cancel, NewValue)
' Displays a message box that asks a user
' if they want to use the new value typed in this object
message = "Current value: " & Value & vbNewLine & _
"New value: " & NewValue & vbNewLine & vbNewLine & _
"Do you accept the new value?"
If MsgBox(message, vbQuestion + vbYesNo, "Validate Event") <> vbYes Then
Cancel = True
End If
End Sub