Repository.Control.GetXfmeaControl: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
(Created page with '{{Template:APIClass|Repository Class|Repository}} Returns XfmeaControl with the provided ID. Returns nothing if the XfmeaControl doesn't exist. ==Syntax== * GetXfmeaControl(ByVa…')
 
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Template:APIClass|Repository Class|Repository}}
{{Template:API}}{{Template:APIBreadcrumb|.[[Repository Class|Repository]]}}
Returns XfmeaControl with the provided ID. Returns nothing if the XfmeaControl doesn't exist.


==Syntax==
* GetXfmeaControl(ByVal ID As Integer) As cXfmeaControl


Parameters
<onlyinclude>Returns a '''[[CXfmeaControl Class|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.</onlyinclude>


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

Latest revision as of 18:52, 9 June 2016

APIWiki.png


Member of: SynthesisAPI.Repository


Returns 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)