Value property (WinStudio scripts)

Applies To

  • IWSApplication interface
  • IWSForm interface
  • IWSFormComponent interface
  • IWSIDOProperty interface
  • IWSVariable interface
  • IGlobalScriptParm interface

Definition

Sets or returns the value of a form-level or global variable, or the internal string representation of an object.

Get Syntax

object.Value

  Part   Description
object Required.
  • For a form-level variable, a reference to a form.
  • For a global variable, use Application.
  • For components, properties, or global script parameters, a reference to the object for which the value is being returned.

Set Syntax

object.Value = string

  Part   Description
object Required.
  • For a form-level variable, a reference to a form.
  • For a global variable, use Application.
  • For components, properties, or global script parameters, a reference to the object for which the value is being returned.
string Required.

The value to which the variable, component, property, or parameter is to be set.

Remarks

In the Get Syntax, the return value is a string containing the value of the variable, component, property, or parameter.

With the exception of how date and numeric formats are presented, this property is the same as the ValueInternal property. For instance, with this property, dates are presented using the current locale display format. With the ValueInternal property, the date is presented using the WinStudio internal date format.

Examples

Example 1

Sub Main()
   Dim strFormPersVar As String
   Dim strFormTempVar As String
   Dim strGlobalPersVar As String
   'Persistent form-level variable.
   strFormPersVar = ThisForm.Variables("InitialCommand").Value
   Application.ShowMessage("The value of the InitialCommand variable is: " _
      & strFormPersVar)
   'This Set command creates a temporary variable on the current form.
   ThisForm.Variables("NewTempVar").Value = "TestValue"
   strFormTempVar = ThisForm.Variables("NewTempVar").Value
   Application.ShowMessage("Temporary variable value = " & _
      ThisForm.Variables("NewTempVar").Value)
   'Persistent global variable.
   strGlobalPersVar = Application.Variables("AccessAs").Value
   Application.ShowMessage("The value of the AccessAs variable is: " _
      & strGlobalPersVar)
End Sub

Example 2

Sub Main()
   Dim oVar As IWSVariable
   oVar = ThisForm.Variables("InitialCommand")
   Application.ShowMessage(oVar.Value)
End Sub

Example 3

Sub Main()
   Dim vCondition As String
   Dim sVariableName As String
   Dim vValue As String
   Dim iSetOrClear As Integer
   Dim i As Integer
   On Error GoTo ErrorHandler
   ReturnValue = "0"
   vCondition = GetParameter(0)
   iSetOrClear = 0
   If String.IsNullOrEmpty(vCondition) Then
      iSetOrClear = 0
   Else
      If IsNumeric(vCondition) Then
         If CDbl(vCondition) = 0 Then
   iSetOrClear = 0
         Else
   iSetOrClear = 1
         End If
      Else
   iSetOrClear = 1
      End If
   End If
   For i = 1 To (ParameterCount - 2) Step 2
      sVariableName = GetParameter(i)
      If String.IsNullOrEmpty(sVariableName) Then
         Exit For
      End If
      If iSetOrClear = 0 Then
         ThisForm.Variables(sVariableName).Value = ""
      Else
         vValue = GetParameter(i+1)
         ThisForm.Variables(sVariableName).Value = vValue
      End If
   Next i
   Exit Sub
   ErrorHandler:
       Application.ShowMessage("SetOrClearVariables: " & Err.Description)
       ReturnValue = "1"
   Exit Sub
End Sub