<< Prev        Next >>

ID : 5167

SetPublicValue

Function

Assign the value to Public local variable.

Syntax

SetPublicValue value, task name, Public variable name[, dimension 1_Index
[, dimension 2_Index[, dimension n_Index]]]

Guaranteed entry

Value
Designate a value that the value of Public variable assigned to. Designate data type data according to a local variable assigned to.
Task name
Designate a task name by string type data. Refer to "Program File and Task."
Public variable name
Designate a Public local variable which is assigned to by string type data.
Dimension n_Index
Designate an Index number of each dimension by integer type data when a Public attribute variable you assign to is an array.

Description

Assign a value to local variable with Public attribute.

You can also assign array. In this case, the data you assign to and the Public local variable assigned to need to be identical on data type, dimension number and element number.

Attention

Argument for designating Public local variable, "task name" and "Public variable name" are designated by string type data.

Example

'Program name Pro1
' Program which declares Public attribute variable.
	Public pubVal As Integer = 5
	Public pubPos(5) As Position
	
'Program name Test1
Sub Main
	Dim aaa As Integer
	GetPublicValue aaa, "Pro1", "pubVal"	' Load Public variable "pubVal" of "Pro1"
	SetPublicValue aaa + 1, "Pro1", "pubVal"	' Assign it after +1

	Dim n As Integer
	For n = 0 To 5
		'Load an element of Index number n of Public variable "pubPos" which is an array of "Pro1".
		SetPublicValue CurPos, "Pro1", "pubPos", n
		Delay 1000
	Next

	Dim ccc(5) As Position
	For n = Lbound(ccc) To Ubound(ccc)
		ccc(n) = CurPos
		Delay 1000
	Next
	SetPublicValue ccc, "Pro1", "pubPos"	' Assign to Public variable "pubPos" which is
 an array of "Pro1"
End Sub

ID : 5167

<< Prev        Next >>