Repository.Project.GetCurrentProject: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Template:API}}{{Template:APIBreadcrumb|10|.[[Repository Class|Repository]]}}
{{Template:API}}{{Template:APIBreadcrumb|.[[Repository Class|Repository]]}}




<onlyinclude>Returns a '''[[NameIdPair Class|NameIDPair]]''' object that contains the project you are currently connected to.</onlyinclude>
<onlyinclude>Returns a '''[[NameIdPair Class|NameIDPair]]''' object that represents the name and ID pair of the current project.</onlyinclude>


== Syntax ==
== Syntax ==
  '''.Project.GetCurrentProject()'''
  '''.Project.GetCurrentProject'''




Line 11: Line 11:
  '''VBA|VB.NET'''
  '''VBA|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|'Set the first available project in the repository as the current project.}}
  {{APIComment|'Set the first available project in the repository as the current project.}}
Line 22: Line 21:
   Dim ProjectName {{APIPrefix|As}} String
   Dim ProjectName {{APIPrefix|As}} String
   Dim ProjectID {{APIPrefix|As}} Integer
   Dim ProjectID {{APIPrefix|As}} Integer
   ProjectName = MyRepository.Project.GetCurrentProject().Name
   ProjectName = MyRepository.Project.GetCurrentProject.Name
   ProjectID = MyRepository.Project.GetCurrentProject().ID
   ProjectID = MyRepository.Project.GetCurrentProject.ID
   MsgBox ({{APIString|"You are currently connected to: "}} & ProjectName & {{APIString|", ID#"}} & ProjectID)
   MsgBox ({{APIString|"You are currently connected to: "}} & ProjectName & {{APIString|", ID#"}} & ProjectID)

Latest revision as of 17:30, 9 June 2016

APIWiki.png


Member of: SynthesisAPI.Repository


Returns a NameIDPair object that represents the name and ID pair of the current project.

Syntax

.Project.GetCurrentProject


Example

VBA|VB.NET

 'Declare a new Repository object and connect to a Synthesis repository. 
  Dim MyRepository As New Repository
  MyRepository.ConnectToAccessRepository("C:\RSRepository1.rsr10")

 'Set the first available project in the repository as the current project. 
  MyRepository.Project.SetCurrentProject(1)

 'Output example: Display the name and ID of the current project. 
  Dim ProjectName As String
  Dim ProjectID As Integer
  ProjectName = MyRepository.Project.GetCurrentProject.Name
  ProjectID = MyRepository.Project.GetCurrentProject.ID
  MsgBox ("You are currently connected to: " & ProjectName & ", ID#" & ProjectID)