Repository.Message

From ReliaWiki
Jump to navigation Jump to search
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