Repository.Variable.GetVariable

Gets the variable with the designated ID number and returns it as a cVariable object. Returns nothing if the variable does not exist or is not in the current project.

Syntax
.Variable.GetVariable(ID)

Parameters
ID
 * Required. Integer. The ID number of the variable to retrieve.

Example
The example assumes that a variable with ID #1 exists in the first project of a Synthesis repository.

VBA MyRepository Repository AVariable cVariable MyRepository.Project.SetCurrentProject(1) AVariable = MyRepository.Variable.GetVariable(1) VariableName String VariableID Integer VariableName = AVariable.Name VariableID = AVariable.ID MsgBox ( & VariableName &  & VariableID)

VB.NET MyRepository Repository AVariable cVariable MyRepository.Project.SetCurrentProject(1) AVariable = MyRepository.Variable.GetVariable(1) VariableName String VariableID Integer VariableName = AVariable.Name VariableID = AVariable.ID MsgBox ( & VariableName &  & VariableID)