WeibullDataSet.Message: Difference between revisions

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


Display a message.


== Method Syntax ==
<onlyinclude>Occurs when an error is produced. Displays an error message.</onlyinclude>
{{APIName|'''Message'''(}}
{{APIPrefix|ByVal}}
{{APIName|sender}}
{{APIPrefix|As}}
{{APIName|[[WeibullDataSet Class|WeibullDataSet]],}}
{{APIPrefix|ByVal}}
{{APIName|sMsg}}
{{APIPrefix|As String}}
{{APIName|,}}
{{APIPrefix|ByVal}}
{{APIName|AdditionalInfo}}
{{APIPrefix|As String}}
{{APIName|,}}
{{APIPrefix|ByVal}}
{{APIName|IsCritical}}
{{APIPrefix|As Boolean}}
{{APIName|)}}<br>
{{APIComment|Called by ‘sender’ when a message should be displayed.}}


== Parameters ==
'''sender'''
An WeibullDataSet object


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


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


'''IsCritical'''
===Parameters===
(This might be used to indicate which icon to display.)
''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|Declare a New class that Inherits from WeibullEvents.}}<br>
== Example ==
{{APIComment|Override the method.}}<br>
The following example provides a simple demonstration on how to customize the event procedure.
      Private Class myEvents
'''VBA'''
          Inherits WeibullEvents
 
            Public Overrides Sub Message(sender As WeibullDataSet, sMsg As String, AdditionalInfo As String, IsCritical As Boolean)
{{APIComment|'Specify a variable to handle the event.}}
                MyBase.Message(sender, sMsg, AdditionalInfo, IsCritical)
  {{APIPrefix|Private WithEvents}} wds {{APIPrefix|As}} WeibullDataSet
                {{APIComment|Add additional code.}}
            End Sub
{{APIComment|'----------------------------}}
        End Class
  {{APIPrefix|Private Sub}} Main()
  {{APIComment|'Associate the event variable with an object.}}
    {{APIPrefix|Set}} wds = {{APIPrefix|New}} WeibullDataSet
  {{APIComment|'Set the application to use your event procedure.}}
    wds.UseEvents = True
  {{APIComment|'To trigger the event, call the Calculate method without defining a data set. }}
    wds.Calculate
    Msgbox({{APIString|"End"}})
  {{APIPrefix|End Sub}}
{{APIComment|'----------------------------}}
  {{APIPrefix|Private Sub}} wds_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}}


{{APIComment|Declare the WeibullDataSet.}}<br>
'''VB.NET'''
        Dim WDS as New WeibullDataSet
 
{{APIComment|'Specify a variable to handle the event.}}
{{APIComment|Use the created myEvents class in place of the one created by the dataset.}}<br>
  {{APIPrefix|Private WithEvents}} wds {{APIPrefix|As}} WeibullDataSet
        WDS.Events = New myEvents
 
{{APIComment|'----------------------------}}
{{APIComment|Show a prompt with the respective strings.  The additional code should also run.}}
  {{APIPrefix|Private Sub}} Main()
        WEvents.Message(WDS, "Message1", "AdditionalInfo1", False)
  {{APIComment|'Associate the event variable with an object.}}
    wds = {{APIPrefix|New}} WeibullDataSet
  {{APIComment|'Set the application to use your event procedure.}}
    wds.UseEvents = True
  {{APIComment|'To trigger the event, call the Calculate method without defining a data set. }}
    wds.Calculate
    Msgbox({{APIString|"End"}})
  {{APIPrefix|End Sub}}
{{APIComment|'----------------------------}}
  {{APIPrefix|Private Sub}} wds_Message(msg {{APIPrefix|As String}}, IsCritical {{APIPrefix|As Boolean}}) {{APIPrefix|Handles}} wds.Message
  {{APIComment|'<Add code here to handle the event.>}}
    MsgBox (msg)
  {{APIPrefix|End Sub}}

Latest revision as of 23:40, 6 September 2016

APIWiki.png


Member of: SynthesisAPI.WeibullDataSet


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. 
  Private WithEvents wds As WeibullDataSet

 '----------------------------  
 Private Sub Main()
   'Associate the event variable with an object. 
    Set wds = New WeibullDataSet

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

   'To trigger the event, call the Calculate method without defining a data set.  
    wds.Calculate
    Msgbox("End")
 End Sub

 '---------------------------- 
 Private Sub wds_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. 
  Private WithEvents wds As WeibullDataSet

 '---------------------------- 
 Private Sub Main()
   'Associate the event variable with an object. 
    wds = New WeibullDataSet

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

   'To trigger the event, call the Calculate method without defining a data set.  
    wds.Calculate
    Msgbox("End")
 End Sub

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