Referencing variables in WinStudio scripts

Variables are mechanisms for storing data needed by WinStudio at run time. Global variables are available to all forms. Form variables are available only to the form for which they were defined.

Persistent variables maintain their values across executions of the form (for form variables) or WinStudio (for global variables). Temporary or nonpersistent variables do not have to be explicitly defined. WinStudio creates them automatically as they are referenced.

Referencing a global variable

Global variables are accessed through the Variables property of the WinStudio Application object. Their values can be retrieved or set using the Value property of the Application object. The following code sets the value of the variable GlobalVariable to "New Value."


   '  Set GlobalVariable to "New Value"
   Application.Variables("GlobalVariable").Value = "New Value"

Referencing a form variable

Form variables are accessed through the Variables property of the Form object. The following code assigns the value of one of the current form's variables to the variable strVariableValue.


   '  Assign the value of the current form's FormVariable
   '  to strVariableValue
   Dim strVariableValue as String
   strVariableValue = ThisForm.Variables("FormVariable").Value
Rubriques liées