Community articleIsValidFormat function
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Description

This function returns the boolean result of whether a string is valid according to the setting of the node's format option.

Function

   Function IsValidFormat(
      theString As String
      ) As Boolean


Parameters

Table 1. Function parameters
ExpressionTypeDescription
theStringString
A string to be checked against the format. For example, to check 23.2 against a specific format, the string would be “23.2”.


Returns

True if the string does match the format, False if it does not.

Example

The following function locates the Currency field and checks to see if “23.2” conforms to the format required by the field's format option.
   Sub CheckFormat(TheForm)
 
      Dim theItem ' object
 
      ' Locate the Currency field
 
      Set theItem = TheForm.DereferenceEx(vbNullString, _
         "PAGE1.Currency", 0, UFL_OPTION_REFERENCE, Nothing)
 
      ' Check the string to see if it is valid. If it is valid, then
      ' enter the string into the Currency field.
      ' Otherwise, do nothing.
 
      If theItem.IsValidFormat("23.2") = True Then
         
      theItem.SetLiteralByRefEx vbNullString, "value", 0, vbNullString, Nothing, _ 
         "23.2"
      
      End If
 
   End Sub


Parent topic:
FormNodeP functions