Talk:WeibullDataSet.Message/Notes: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
(Created page with '=DRAFT= Occurs when the <code>Calculate</code> or <code>CalculateBestFit</code> method is called but no data set has been defined. The application is unable to calculate the pa…')
 
No edit summary
Line 1: Line 1:
=DRAFT=
=DRAFT= __NOTOC__


Occurs when the <code>Calculate</code> or <code>CalculateBestFit</code> method is called but no data set has been defined or there is insufficient data to calculate the parameters of a distribution.


Occurs when the <code>Calculate</code> or <code>CalculateBestFit</code> method is called but no data set has been defined. The application is unable to calculate the parameters when there is no data.
To handle custom events, set the <code>UseEvents</code> property of the object to True. The <code>Calculate</code> method raises the event once, when it is unable to calculate the parameters of the data. The <code>CalculateBestFit</code> method raises the event once for each distribution that is selected to be included in the analysis that has no or insufficient data.


== Syntax ==
== Syntax ==
Line 15: Line 16:


== Example ==
== Example ==
 
The following example provides a simple demonstration on how to handle a custom event.
  '''VBA'''
  '''VBA'''
   
   
  {{APIPrefix|Private WithEvents}} wds {{APIPrefix|As}} WeibullDataSet
  {{APIComment|'Specify a variable to handle the event.}}
  {{APIPrefix|Private WithEvents}} wds {{APIPrefix|As}} WeibullDataSet
   
   
{{APIPrefix|Sub}} Main()
  {{APIPrefix|Sub}} Main()
  {{APIComment|'Associate the event with an object.}}
  {{APIComment|'Associate the event variable with an object.}}
    {{APIPrefix|Set}} wds = {{APIPrefix|New}} WeibullDataSet
    {{APIPrefix|Set}} wds = {{APIPrefix|New}} WeibullDataSet
   
   
  {{APIComment|'Set the API to use custom events.}}
  {{APIComment|'Set the application to handle custom events.}}
    wds.UseEvents = True
    wds.UseEvents = True
   
   
  {{APIComment|'Call the Calculate method without defining a data set. }}
  {{APIComment|'To raise the event, call the Calculate method without defining a data set. }}
    wds.Calculate
    wds.Calculate
     Msgbox({{APIString|"End"}})
     Msgbox({{APIString|"End"}})
{{APIPrefix|End Sub()}}
  {{APIPrefix|End Sub}}
   
  {{APIComment|'----------------------------}}
{{APIPrefix|Private Sub}} wds_Message({{APIPrefix|ByVal}} Msg {{APIPrefix|As String}}, {{APIPrefix|ByVal}} IsCritical {{APIPrefix|As Boolean}})
  {{APIComment|'Add custom code here to handle the event.}}
  {{APIComment|'...}}
  {{APIComment|'...}}
    MsgBox ({{APIString|"Custom event procedure working."}})
{{APIPrefix|End Sub}}
 
 
 
 
   
   
{{APIComment|'Create a new class and inherit WeibullEvents.}}
  {{APIPrefix|Private Sub}} wds_Message({{APIPrefix|ByVal}} Msg {{APIPrefix|As String}}, {{APIPrefix|ByVal}} IsCritical {{APIPrefix|As Boolean}})
  Private Class myEvents
  {{APIComment|'<Add code here to handle the event.>}}
      Inherits WeibullEvents
    MsgBox ({{APIString|"Custom event procedure working."}})
    {{APIComment|'Request overrides.}}
   {{APIPrefix|End Sub}}
          Public Overrides Sub Message(sender As WeibullDataSet, 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|'Declare a new WeibullDataSet.}}
   Dim WDS as New WeibullDataSet
 
{{APIComment|'Use the created myEvents class in place of the one created by the dataset.}}
  WDS.Events = New myEvents
 
{{APIComment|'Show a prompt with the respective strings.  The additional code will also run.}}
  WDS.Events.Message(WDS, "Message1", "AdditionalInfo1", False)

Revision as of 15:43, 11 August 2016

DRAFT

Occurs when the Calculate or CalculateBestFit method is called but no data set has been defined or there is insufficient data to calculate the parameters of a distribution.

To handle custom events, set the UseEvents property of the object to True. The Calculate method raises the event once, when it is unable to calculate the parameters of the data. The CalculateBestFit method raises the event once for each distribution that is selected to be included in the analysis that has no or insufficient data.

Syntax

_Message(ByVal msg As String, ByVal IsCritical As Boolean)

Parameters

msg

The main display label.

IsCritical

Indicates whether the message displayed is critical.


Example

The following example provides a simple demonstration on how to handle a custom event.

VBA

 'Specify a variable to handle the event. 
  Private WithEvents wds As WeibullDataSet

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

   'Set the application to handle custom events. 
    wds.UseEvents = True

   'To raise 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 ("Custom event procedure working.")
 End Sub