ID : 5167
SetPublicValue
功能
将值代入Public属性的局部变量中。
格式
SetPublicValue 值, 任务名, Public变量名[, 次元1_Index[, 次元2_Index[, 次元n_Index]]]
指定项目
注意事项
通过字符串型数据指定用于指定Public属性局部变量的自变量、“任务名”和“Public变量名”。
应用示例
'过程名Pro1
' 为定义Public属性变量的程序。
Public pubVal As Integer = 5
Public pubPos(5) As Position
'过程名Test1
Sub Main
Dim aaa As Integer
GetPublicValue aaa, "Pro1", "pubVal" '读取"Pro1"的Public变量"pubVal"
SetPublicValue aaa + 1, "Pro1", "pubVal" ' +1后代入
Dim n As Integer
For n = 0 To 5
'读取“Pro1”排列的Public变量“pubPos”中Index编号n的要素
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" '代入"Pro1"排列的Public变量"pubPos"中
End Sub
ID : 5167