VarSet.put Method
Saves a variable value in the VarSet object.
VarSet.put(VariableName String, Value Variant)
Parameters
- VariableName
Specifies the name of the variable value to save to the VarSet object. - Value
Specifies the variable value to save to the VarSet object.
Return Value
None
Examples
The following example uses the get and put methods to update a value stored in a VarSet object.
Function IncrementCriticalErrors()
Const ERROR_VARSET_NAME = "Error Tracker"
Const NORMAL_ERROR_COUNT = "Number of Errors"
Const CRITICAL_ERROR_COUNT = "Number of Critical Errors"
Dim objScriptState
Dim objErrorVarSet
Dim vntCriticalErrors
Set objScriptState = ScriptContext.GetScriptState()
Set objErrorVarSet = objScriptState.GetSet(ERROR_VARSET_NAME)
' get and modify count values
vntCriticalErrors = objErrorVarSet.get(CRITICAL_ERROR_COUNT)
vntCriticalErrors = CLng(vntCriticalErrors) + 1
' save variable changes back to the VarSet
Call objErrorVarSet.put(CRITICAL_ERROR_COUNT, vntCriticalErrors)
' save the VarSet
Call objScriptState.SaveSet(ERROR_VARSET_NAME, objErrorVarSet)
Set objErrorVarSet = Nothing
Set objScriptState = Nothing
IncrementCriticalErrors = CLng(vntCriticalErrors)
End Function
Requirements
Platforms: Requires Windows 2000 or later
Version: Requires MOM 2000 or later