WeibullDataSet.Question: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
m (moved WeibullEvents.Question to WeibullDataSet.Question: Change in API structure)
No edit summary
Line 1: Line 1:
{{Template:API}}{{Template:APIBreadcrumb}}
{{Template:API}}{{Template:APIBreadcrumb|.[[WeibullDataSet Class|WeibullDataSet]]}}
{{Template:InProgress}}
{{Template:InProgress}}
<onlyinclude>Occurs when an answer to a question is required.</onlyinclude>
{{Template:API_EventsNote}}
== Syntax ==
'''_Question'''({{APIPrefix|ByVal}} ''msg'' {{APIPrefix|As String}}, {{APIPrefix|ByVal}} ''Buttons'' {{APIPrefix|As Microsoft_VisualBasic.MsgBoxStyle}}, {{APIPrefix|ByRef}} ''Answer'' {{APIPrefix|As Microsoft_VisualBasic.MsgBoxResult}})
===Parameters===
''sMsg''
:The message to display.
''Buttons''
:The buttons to display when calling Visual Basic's MsgBox function. (See [https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.msgboxstyle.aspx Microsoft's reference documentation].)
''Answer''
:Indicates which button was pressed in a message box, returned by Visual Basic's MsgBox function. (See [https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.msgboxresult.aspx Microsoft's reference documentation].)
== Example ==
The following example provides a simple demonstration on how to handle the event.
'''VBA'''
{{APIComment|'Specify a variable to handle the event.}}
  {{APIPrefix|Private WithEvents}} wds {{APIPrefix|As}} WeibullDataSet
{{APIComment|'----------------------------}}
  {{APIPrefix|Sub}} Main()
  {{APIComment|'Associate the event variable with an object.}}
    {{APIPrefix|Set}} wds = {{APIPrefix|New}} WeibullDataSet
  {{APIComment|'Set the application to use events.}}
    wds.UseEvents = True
  {{APIComment|'To raise the event, calculate a data set with a single data point.}}
    {{APIPrefix|Call}} wds.AddFailure(100, 1)
    wds.Calculate
    Msgbox({{APIString|"End"}})
  {{APIPrefix|End Sub}}
{{APIComment|'----------------------------}}
  {{APIPrefix|Private Sub}} wds_Question({{APIPrefix|ByVal}} ''msg'' {{APIPrefix|As String}}, _
                          {{APIPrefix|ByVal}} ''Buttons'' {{APIPrefix|As Microsoft_VisualBasic.MsgBoxStyle}}, _
                          {{APIPrefix|ByRef}} ''Answer'' {{APIPrefix|As Microsoft_VisualBasic.MsgBoxResult}})
  {{APIComment|'<Add code here to handle the event.>}}
    MsgBox (msg)
  {{APIPrefix|End Sub}}
'''VB.NET'''
{{APIComment|'Specify a variable to handle the event.}}
  {{APIPrefix|Private WithEvents}} wds {{APIPrefix|As}} WeibullDataSet
{{APIComment|'----------------------------}}
  {{APIPrefix|Sub}} Main()
  {{APIComment|'Associate the event variable with an object.}}
    wds = {{APIPrefix|New}} WeibullDataSet
  {{APIComment|'Set the application to use events.}}
    wds.UseEvents = True
  {{APIComment|'To raise the event, calculate a data set with a single data point.}}
    wds.AddFailure(100, 1)
    wds.Calculate
    Msgbox({{APIString|"End"}})
  {{APIPrefix|End Sub}}
{{APIComment|'----------------------------}}
  {{APIPrefix|Private Sub}} wds_Question(''msg'' {{APIPrefix|As String}}, ''Buttons'' {{APIPrefix|As MsgBoxStyle}}, _
                          {{APIPrefix|ByRef}} ''Answer'' {{APIPrefix|As MsgBoxResult}}) {{APIPrefix|Handles}} wds.Question
  {{APIComment|'<Add code here to handle the event.>}}
    MsgBox (msg)
  {{APIPrefix|End Sub}}

Revision as of 18:13, 12 August 2016

APIWiki.png


Member of: SynthesisAPI.WeibullDataSet Template:InProgress


Occurs when an answer to a question is required.


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

_Question(ByVal msg As String, ByVal Buttons As Microsoft_VisualBasic.MsgBoxStyle, ByRef Answer As Microsoft_VisualBasic.MsgBoxResult)

Parameters

sMsg

The message to display.

Buttons

The buttons to display when calling Visual Basic's MsgBox function. (See Microsoft's reference documentation.)

Answer

Indicates which button was pressed in a message box, returned by Visual Basic's MsgBox function. (See Microsoft's reference documentation.)

Example

The following example provides a simple demonstration on how to handle the 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 use events. 
    wds.UseEvents = True

   'To raise the event, calculate a data set with a single data point. 
    Call wds.AddFailure(100, 1)
    wds.Calculate
    Msgbox("End")
 End Sub

 '---------------------------- 
 Private Sub wds_Question(ByVal msg As String, _
                          ByVal Buttons As Microsoft_VisualBasic.MsgBoxStyle, _
                          ByRef Answer As Microsoft_VisualBasic.MsgBoxResult)
   '<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

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

   'Set the application to use events. 
    wds.UseEvents = True

   'To raise the event, calculate a data set with a single data point. 
    wds.AddFailure(100, 1)
    wds.Calculate
    Msgbox("End")
 End Sub

 '---------------------------- 
 Private Sub wds_Question(msg As String, Buttons As MsgBoxStyle, _
                          ByRef Answer As MsgBoxResult) Handles wds.Question
   '<Add code here to handle the event.> 
    MsgBox (msg)
 End Sub