Repository.Control.GetXfmeaControl

From ReliaWiki
Revision as of 16:54, 9 June 2016 by Kate Racaza (talk | contribs)
Jump to navigation Jump to search
APIWiki.png


Member of: SynthesisAPI.Repository


Gets a cXfmeaControl object that represents a given control resource in the current project. Returns nothing if the control does not exist or is not in the current project.

Syntax

.Control.GetXfmeaControl(ID)

Parameters

ID

Integer. The ID number of the control to retrieve.


Example

This example assumes that an Xfmea control with ID#1 exists in a repository.

VBA

 'Declare a new Repository object and connect to a Synthesis repository. 
  Dim MyRepository As New Repository
  MyRepository.ConnectToAccessRepository("C:\RSRepository1.rsr10")
 
 'Get control #1 from project #1. 
  Dim MyControl As cXfmeaControl
  MyRepository.Project.SetCurrentProject(1)
  Set MyControl = MyRepository.Control.GetXfmeaControl(1)

 'Output sample: Display the name and ID of the control. 
  Dim ControlName As String
  Dim ControlID As Integer
  ControlName = MyControl.Name
  ControlID = MyControl.ID
  MsgBox ("ID# " & ControlID & ", " & ControlName)
VB.NET

 'Declare a new Repository object and connect to a Synthesis repository. 
  Dim MyRepository As New Repository
  MyRepository.ConnectToAccessRepository("C:\RSRepository1.rsr10")
 
  'Get control #1 from project #1. 
  Dim MyControl As cXfmeaControl
  MyRepository.Project.SetCurrentProject(1)
  MyControl = MyRepository.Control.GetXfmeaControl(1)

 'Output sample: Display the name and ID of the control. 
  Dim ControlName As String
  Dim ControlID As Integer
  ControlName = MyControl.Name
  ControlID = MyControl.ID
  MsgBox ("ID# " & ControlID & ", " & ControlName)