Repository.Message: Difference between revisions

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




Line 6: Line 5:




'''Remarks''': To write your own code for the event procedure, set the <code>UseEvents</code> property of the <code>Repository</code> object to True. The event is raised by the class methods.
{{Template:API_EventsNote}}


==Syntax==
==Syntax==

Latest revision as of 23:41, 6 September 2016

APIWiki.png


Member of: SynthesisAPI.Repository


Occurs when an error is produced. Displays an error message.


Remarks: To hide the messages or write your own code for the event procedure, set the UseEvents property of the object to True. The event is raised by the class methods.

Syntax

_Message(msg)

Parameters

msg

Required. String. The message to display when an error occurs.


Example

The following example provides a simple demonstration on how to customize the event procedure.

VBA

 'Specify a variable to handle the event. 
  Public WithEvents MyRepository As Repository

 '----------------------------  
 Public Sub Main()
   'Associate the event variable with an object. 
    Set MyRepository = New Repository

   'Set the application to use your event procedure. 
    MyRepository.UseEvents = True

   'Connect to a Synthesis repository. 
    MyRepository.ConnectToAccessRepository("C:\RSRepository1.rsr11")
 
   'Create a new action. 
    Dim NewAction As New cAction
    NewAction.ActionDescription = "MyNewAction"
 
   'Trigger the event by sending the new action to the repository without specifying a target project. 
    Call MyRepository.Action.AddAction(NewAction)

    Msgbox("End")
    End Sub

 '---------------------------- 
 Private Sub MyRepository_Message(ByVal msg As String)
   '<Add code here to handle the event.> 
    MsgBox (msg)
 End Sub
VB.NET

 'Specify a variable to handle the event. 
  Public WithEvents MyRepository As Repository

 '----------------------------  
 Sub Main()
   'Associate the event variable with an object. 
    MyRepository = New Repository

   'Set the application to use your event procedure. 
    MyRepository.UseEvents = True

   'Connect to a Synthesis repository. 
    MyRepository.ConnectToAccessRepository("C:\RSRepository1.rsr11")
 
   'Create a new action. 
    Dim NewAction As New cAction
    NewAction.ActionDescription = "MyNewAction"
 
   'Trigger the event by sending the new action to the repository without specifying a target project. 
    MyRepository.Action.AddAction(NewAction)

    Msgbox("End")
    End Sub

 '---------------------------- 
 Private Sub MyRepository_Message(msg As String) Handles MyRepository.Message
   '<Add code here to handle the event.> 
    MsgBox (msg)
 End Sub