Repository.Message: Difference between revisions
Jump to navigation
Jump to search
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…') |
Kate Racaza (talk | contribs) No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Template:API}}{{Template:APIBreadcrumb|.[[Repository Class|Repository]]}} | {{Template:API}}{{Template:APIBreadcrumb|.[[Repository Class|Repository]]}} | ||
<onlyinclude>Occurs when | <onlyinclude>Occurs when an error is produced. Displays an error message.</onlyinclude> | ||
{{Template:API_EventsNote}} | |||
==Syntax== | ==Syntax== | ||
Line 40: | Line 39: | ||
NewAction.ActionDescription = {{APIString|"MyNewAction"}} | NewAction.ActionDescription = {{APIString|"MyNewAction"}} | ||
{{APIComment|' | {{APIComment|'Trigger the event by sending the new action to the repository without specifying a target project.}} | ||
{{APIPrefix|Call}} MyRepository.Action.AddAction(NewAction) | {{APIPrefix|Call}} MyRepository.Action.AddAction(NewAction) | ||
Line 72: | Line 71: | ||
NewAction.ActionDescription = {{APIString|"MyNewAction"}} | NewAction.ActionDescription = {{APIString|"MyNewAction"}} | ||
{{APIComment|' | {{APIComment|'Trigger the event by sending the new action to the repository without specifying a target project.}} | ||
MyRepository.Action.AddAction(NewAction) | MyRepository.Action.AddAction(NewAction) | ||
Latest revision as of 23:41, 6 September 2016
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