ValidateData method (WinStudio scripts)

Applies To

IWSFormComponent interface

Definition

Runs a component's validators and returns a Boolean value indicating whether the validation was successful.

Syntax

object.ValidateData( Boolean )

  Part   Description
object Required. A reference to a form component object.
Boolean Required. Determines whether and when a component's value should be validated:
  • TRUE: The component's value is to be validated.
  • FALSE: The component's value is to be validated only if the component is of a type that can hold data, the value is marked as "modified", and the value has not already been validated.

Remarks

A return value of:

  • TRUE indicates that validation was successful.
  • FALSE indicates that validation was not successful. If the validation is unsuccessful, a message is displayed to the user.

Example

Sub Main()
   'This script runs validators on a component.
   'It takes one input parameter, a reference to a form component.
   Dim ReturnValue As String
   On Error GoTo ErrorHandler
   If ThisForm.Components("StringTableNameGridCol").ValidateData(True) Then
      ReturnValue = "0"
      Application.ShowMessage("Validation was successful.")
   Else
      ReturnValue = "1"
      Application.ShowMessage("Validation was not successful.")
   End If
   Exit Sub
ErrorHandler:
   Application.ShowMessage("RunValidatorsOnComponent: " & Err.Description)
   ReturnValue = "1"
End Sub