Set Global Command

Sets the value of a global numeric or String variable.

Set Global variable_name_expression, project_name
data ^Z

Prerequisites

The variable specified by variable_name_expression must already exist in a project loaded in memory. If an object is referenced, the object must be instantiated.

Parameters

variable_name_expression

A required parameter that references a global numeric or String variable. This may be a simple variable, a variable qualified by a class or module name, or a field within an object.

project_name

An optional parameter that specifies the name of the project in which the global variable is defined. If omitted, all projects are searched alphabetically and the first matching variable is assumed.

data

A required parameter that defines the value to be stored in the global variable. It consists of ASCII characters, terminated by a control-Z character (ASCII 26). It value must be compatible with the data type of the variable, either numeric or String.

Remarks

This command permits a global variable to be modified from outside a project, for example, from a separate project or from an external interface such as GDE.

The variable_name_expression parameter may be thought of as the part of an assignment statement found on the left-hand side of the = operator.

The data parameter may be thought of as the right-hand side of an assignment statement. It must contain standard ASCII characters, terminated by ASCII 26. For String variables, the data may be arbitrarily long, and can contain embedded carriage-return and line-feed characters (ASCII 13 and ASCII 10).

Examples

Assume you have a program running with the following declarations:

Module GPL

Public l1 As New Location
Public i1 As Integer
Public s1 As String
End Module

The following commands would then be valid:

GPL: set global GPL.i1
123^Z

GPL: set global s1
This is a
string value^Z


GPL: set global l1.x

125.25^Z

See Also

Console Commands | Show Global Command