ALTADataSet.Message: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Template:APIClass|ALTAEvents Class|ALTAEvents}}
{{Template:API}}{{Template:APIBreadcrumb|.[[ALTADataSet Class|ALTADataSet]]}}
{{Template:WeibullEvents.Message.Cmt}}


== Syntax ==
<ul><li>Message(
{{APIName|sender}}
{{APIPrefix|As}}
{{APIName|[[ALTADataSet Class|ALTADataSet]],}}
{{APIName|sMsg}}
{{APIPrefix|As String}}
{{APIName|,}}
{{APIName|AdditionalInfo}}
{{APIPrefix|As String}}
{{APIName|,}}
{{APIName|IsCritical}}
{{APIPrefix|As Boolean}}
{{APIName|)}}</li></ul>


Parameters
<onlyinclude>Occurs when an error is produced. Displays an error message.</onlyinclude>
:''sender'': An ALTADataSet object
 


:''sMsg'': The main display label.
{{Template:API_EventsNote}}


:''AdditionalInfo'': The remaining label.
== Syntax ==
'''_Message'''(''msg'', ''IsCritical'')


:''IsCritical'': Indicates whether the message displayed is critical.
===Parameters===
''msg''
: Required. String. The message to display when an error occurs.
''IsCritical''
: Required. Boolean. Indicates whether the error is critical. Default value = False.


== Usage Example ==


{{APIComment|'Overrides requested, Create a new class and Inherit WeibullEvents, and set the dataset's events.}}
== Example ==
  Private Class myEvents
The following example provides a simple demonstration on how to customize the event procedure.
      Inherits WeibullEvents
'''VBA'''
      Public Overrides Sub Message(sender As ALTADataSet, sMsg As String,
        AdditionalInfo As String, IsCritical As Boolean)
          MyBase.Message(sender, sMsg, AdditionalInfo, IsCritical)
                {{APIComment|'<Add additional code here.>}}
      End Sub
  End Class
    
    
  {{APIComment|'Set the new Events class.}}
  {{APIComment|'Specify a variable to handle the event.}}
   ADS.Events = New myEvents
  {{APIPrefix|Public WithEvents}} ads {{APIPrefix|As}} ALTADataSet
{{APIComment|'----------------------------}}
  {{APIPrefix|Public Sub}} Main()
  {{APIComment|'Associate the event variable with an object.}}
    {{APIPrefix|Set}} ads = {{APIPrefix|New}} ALTADataSet
  {{APIComment|'Set the application to use your event procedure.}}
    ads.UseEvents = True
  {{APIComment|'Trigger the event by calling the Calculate method without defining a data set. }}
    ads.Calculate
    Msgbox({{APIString|"End"}})
  {{APIPrefix|End Sub}}
{{APIComment|'----------------------------}}
  {{APIPrefix|Private Sub}} ads_Message({{APIPrefix|ByVal}} msg {{APIPrefix|As String}}, {{APIPrefix|ByVal}} IsCritical {{APIPrefix|As Boolean}})
  {{APIComment|'<Add code here to handle the event.>}}
    MsgBox (msg)
   {{APIPrefix|End Sub}}
 
'''VB.NET'''
{{APIComment|'Specify a variable to handle the event.}}
  {{APIPrefix|Public WithEvents}} ads {{APIPrefix|As}} ALTADataSet
{{APIComment|'----------------------------}}
  {{APIPrefix|Sub}} Main()
  {{APIComment|'Associate the event variable with an object.}}
    ads = {{APIPrefix|New}} ALTADataSet
  {{APIComment|'Set the application to use your event procedure.}}
    ads.UseEvents = True
  {{APIComment|'Trigger the event by calling the Calculate method without defining a data set. }}
    ads.Calculate
    Msgbox({{APIString|"End"}})
  {{APIPrefix|End Sub}}
   
   
  {{APIComment|'Send a message.}}
  {{APIComment|'----------------------------}}
   ADS.Events.Message(ADS, "message", "additional info", False)
   {{APIPrefix|Private Sub}} ads_Message(msg {{APIPrefix|As String}}, IsCritical {{APIPrefix|As Boolean}}) {{APIPrefix|Handles}} ads.Message
  {{APIComment|'<Add code here to handle the event.>}}
    MsgBox (msg)
  {{APIPrefix|End Sub}}

Latest revision as of 23:43, 6 September 2016

APIWiki.png


Member of: SynthesisAPI.ALTADataSet


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, IsCritical)

Parameters

msg

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

IsCritical

Required. Boolean. Indicates whether the error is critical. Default value = False.


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 ads As ALTADataSet

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

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

   'Trigger the event by calling the Calculate method without defining a data set.  
    ads.Calculate
    Msgbox("End")
 End Sub

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

 'Specify a variable to handle the event. 
  Public WithEvents ads As ALTADataSet

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

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

   'Trigger the event by calling the Calculate method without defining a data set.  
    ads.Calculate
    Msgbox("End")
 End Sub

 '---------------------------- 
 Private Sub ads_Message(msg As String, IsCritical As Boolean) Handles ads.Message
   '<Add code here to handle the event.> 
    MsgBox (msg)
 End Sub