Repository.Control.GetXfmeaControl: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 2: Line 2:




<onlyinclude>Gets the Xfmea control with the designated ID number and returns it as a '''[[CXfmeaControl Class|cXfmeaControl]]''' object. Returns nothing if the control does not exist or is not in the current project.</onlyinclude>  
<onlyinclude>Returns a '''[[CXfmeaControl Class|cXfmeaControl]]''' object, which represents a control resource. Returns nothing if the control does not exist or is not in the current project.</onlyinclude>  


== Syntax ==
== Syntax ==
Line 15: Line 15:
  '''VBA'''
  '''VBA'''
   
   
  {{APIComment|'Add code to connect to a Synthesis repository.}}
  {{APIComment|'Declare a new Repository object and connect to a Synthesis repository.}}
   {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
   {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
  {{APIComment|...}}
  MyRepository.ConnectToAccessRepository({{APIString|"C:\RSRepository1.rsr10"}})
 
  {{APIComment|'Get control #1 from project #1.}}
  {{APIComment|'Get control #1 from project #1.}}
  {{APIPrefix|Dim}} MyControl {{APIPrefix|As}} cXfmeaControl
  {{APIPrefix|Dim}} MyControl {{APIPrefix|As}} cXfmeaControl
  MyRepository.Project.SetCurrentProject(1)
  MyRepository.Project.SetCurrentProject(1)
  {{APIPrefix|Set}} MyControl = MyRepository.Control.GetXfmeaControl(1)
  {{APIPrefix|Set}} MyControl = MyRepository.Control.GetXfmeaControl(1)
   
   
  {{APIComment|'Output sample: Display the name and ID of the control.}}
  {{APIComment|'Output sample: Display the name and ID of the control.}}
  {{APIPrefix|Dim}} ControlName {{APIPrefix|As}} String
  {{APIPrefix|Dim}} ControlName {{APIPrefix|As}} String
  {{APIPrefix|Dim}} ControlID {{APIPrefix|As}} Integer
  {{APIPrefix|Dim}} ControlID {{APIPrefix|As}} Integer
  ControlName = MyControl.Name
  ControlName = MyControl.Name
  ControlID = MyControl.ID
  ControlID = MyControl.ID
  MsgBox ({{APIString|"ID# "}} & ControlID & {{APIString|", "}} & ControlName)
  MsgBox ({{APIString|"ID# "}} & ControlID & {{APIString|", "}} & ControlName)


  '''VB.NET'''
  '''VB.NET'''
   
   
  {{APIComment|'Add code to connect to a Synthesis repository.}}
  {{APIComment|'Declare a new Repository object and connect to a Synthesis repository.}}
   {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
   {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository
  {{APIComment|...}}
  MyRepository.ConnectToAccessRepository({{APIString|"C:\RSRepository1.rsr10"}})
    
    
  {{APIComment|'Get control #1 from project #1.}}
{{APIComment|'Get control #1 from project #1.}}
  {{APIPrefix|Dim}} MyControl {{APIPrefix|As}} cXfmeaControl
  {{APIPrefix|Dim}} MyControl {{APIPrefix|As}} cXfmeaControl
  MyRepository.Project.SetCurrentProject(1)
  MyRepository.Project.SetCurrentProject(1)
  MyControl = MyRepository.Control.GetXfmeaControl(1)
  MyControl = MyRepository.Control.GetXfmeaControl(1)
   
   
  {{APIComment|'Output sample: Display the name and ID of the control.}}
  {{APIComment|'Output sample: Display the name and ID of the control.}}
  {{APIPrefix|Dim}} ControlName {{APIPrefix|As}} String
  {{APIPrefix|Dim}} ControlName {{APIPrefix|As}} String
  {{APIPrefix|Dim}} ControlID {{APIPrefix|As}} Integer
  {{APIPrefix|Dim}} ControlID {{APIPrefix|As}} Integer
  ControlName = MyControl.Name
  ControlName = MyControl.Name
  ControlID = MyControl.ID
  ControlID = MyControl.ID
  MsgBox ({{APIString|"ID# "}} & ControlID & {{APIString|", "}} & ControlName)
  MsgBox ({{APIString|"ID# "}} & ControlID & {{APIString|", "}} & ControlName)

Revision as of 16:46, 8 April 2016

APIWiki.png


Member of: SynthesisAPI.Repository


Returns a cXfmeaControl object, which represents a control resource. 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)