Repository.Message

From ReliaWiki
Revision as of 23:05, 16 August 2016 by Kate Racaza (talk | contribs) (Created page with '{{Template:API}}{{Template:APIBreadcrumb|.Repository}} {{Template:InProgress}} <onlyinclude>Occurs when a logic error is produced. Displays an error messag…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
APIWiki.png


Member of: SynthesisAPI.Repository Template:InProgress


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


Remarks: To write your own code for the event procedure, set the UseEvents property of the Repository 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"
 
   'To trigger the event, send 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"
 
   'To trigger the event, send 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