WeibullDataSet.Question: Difference between revisions

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


== Syntax ==
<ul><li>Question(
{{APIName|sender}}
{{APIPrefix|As}}
{{APIName|[[WeibullDataSet Class|WeibullDataSet]],}}
{{APIName|sMsg}}
{{APIPrefix|As String}}
{{APIName|,}}
{{APIName|Buttons}}
{{APIPrefix|As}}
{{APIName|MsgBoxStyle,}}
{{APIName|Answer}}
{{APIPrefix|As}}
{{APIName|MsgBoxResult)}}
</li></ul>


Parameters
<onlyinclude>Occurs when an answer to a question is required. Displays a message box with yes and no options.</onlyinclude>
:''sender'': A [[WeibullDataSet Class|WeibullDataSet]] object.


:''sMsg'': The main display label.


:''Buttons'': The MsgBoxStyle that determines the number and display of the buttons. See [http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.msgboxstyle.aspx MsgBoxStyle] for additional details.
{{Template:API_EventsNote}}


:''Answer'': The MsgBoxResult that is returned by the prompt. See [http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.msgboxresult.aspx MsgBoxResult] for additional details.
== Syntax ==
 
'''_Question'''(''msg'', ''Buttons'', {{APIPrefix|ByRef}} ''Answer'')
== Usage Example ==


{{APIComment|'Overrides requested. Create a new class and inherit WeibullEvents. Then set the dataset's events.}}
===Parameters===
  Private Class myEvents
''sMsg''
      Inherits WeibullEvents
:Required. String. The message to display.
      Public Overrides Sub Question(sender As WeibullDataSet, sMsg As String, Buttons As MsgBoxStyle, ByRef Answer As MsgBoxResult)
          MyBase.Question(sender, sMsg, Buttons, Answer)
            {{APIComment|'<Add additional code here.>}}
      End SubEnd Class
 
{{APIComment|'Set the new Events class.}}
  WDS.Events = New myEvents
 
{{APIComment|'Ask a question. Result will be updated in Answer.}}
  WDS.Events.Question(WDS, "Continue?", MsgBoxStyle., Answer)<!--
{{APIComment|Declare a New class that Inherits from WeibullEvents.}}<br>
{{APIComment|Override the method.}}<br>
        Private Class myEvents
            Inherits WeibullEvents
            Public Overrides Sub Question(sender As SynthesisAPI.WeibullDataSet, sMsg As String, Buttons As MsgBoxStyle, ByRef Answer As MsgBoxResult)
                MyBase.Question(sender, sMsg, Buttons, Answer)
                MessageBox.Show("Additional overridden code here.")
            End Sub
        End Class


{{APIComment|Declare the WeibullDataSet.}}<br>
''Buttons''
        Dim WDS as New WeibullDataSet
:Required. The buttons to display when calling Visual Basic's MsgBox function. Can be any MsgBoxStyle constant (see [https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.msgboxstyle.aspx Microsoft's reference documentation for this enum]).


{{APIComment|Use the created myEvents class in place of the one created by the dataset.}}<br>
''Answer''
        WDS.Events = New myEvents
:Required. Indicates which button was pressed on a message box returned by Visual Basic's MsgBox function. Can be any MsgBoxResult constant (see [https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.msgboxresult.aspx Microsoft's reference documentation for this enum]).


{{APIComment|Select a message box style. See [http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.msgboxstyle.aspx MsgBoxStyle] for additional details.}}<br>
== Example ==
{{APIComment|Declare a result variable. See [http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.msgboxresult.aspx MsgBoxResult] for additional details.}}
The following example provides a simple demonstration on how to customize the event procedure.
        Dim MsgBoxStyle1 as MsgBoxStyle = MsgBoxStyle.OkCancel
'''VBA'''
        Dim MsgBoxResult1 as MsgBoxResult
{{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 your event procedure.}}
    wds.UseEvents = True
  {{APIComment|'To trigger the event, analyze 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}}, _
                          ''Answer'' {{APIPrefix|As Microsoft_VisualBasic.MsgBoxResult}})
  {{APIComment|'<Add code here to handle the event.>}}
    {{APIPrefix|Call}} MsgBox (msg, vbYesNoCancel)
  {{APIPrefix|End Sub}}


{{APIComment|Prompts user with "Question1" and returns result in MsgBoxResult1.}}
'''VB.NET'''
        WDS.Events.Question(WDS, "Question1", MsgBoxStyle1, MsgBoxResult1)
-->
{{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 your event procedure.}}
    wds.UseEvents = True
  {{APIComment|'To trigger the event, analyze 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, vbYesNoCancel)
  {{APIPrefix|End Sub}}

Latest revision as of 23:41, 6 September 2016

APIWiki.png


Member of: SynthesisAPI.WeibullDataSet


Occurs when an answer to a question is required. Displays a message box with yes and no options.


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(msg, Buttons, ByRef Answer)

Parameters

sMsg

Required. String. The message to display.

Buttons

Required. The buttons to display when calling Visual Basic's MsgBox function. Can be any MsgBoxStyle constant (see Microsoft's reference documentation for this enum).

Answer

Required. Indicates which button was pressed on a message box returned by Visual Basic's MsgBox function. Can be any MsgBoxResult constant (see Microsoft's reference documentation for this enum).

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

 '---------------------------- 
 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, analyze 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, _
                          Answer As Microsoft_VisualBasic.MsgBoxResult)
   '<Add code here to handle the event.> 
    Call MsgBox (msg, vbYesNoCancel)
 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 your event procedure. 
    wds.UseEvents = True

   'To trigger the event, analyze 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, vbYesNoCancel)
 End Sub