Difference between revisions of "ALTADataSet.Question"

From ReliaWiki
Jump to navigation Jump to search
 
(19 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.Question.Cmt}}
+
{{Template:InProgress}}
 +
 
 +
<onlyinclude>Occurs when an answer to a question is required. Displays a message box with yes and no options.</onlyinclude>
 +
 
 +
 
 +
{{Template:API_EventsNote}}
  
 
== Syntax ==
 
== Syntax ==
<ul><li>Question(
+
'''_Question'''(''msg'', ''Buttons'', {{APIPrefix|ByRef}} ''Answer'')
sender
 
{{APIPrefix|As}}
 
[[ALTADataSet Class|ALTADataSet]],
 
sMsg
 
{{APIPrefix|As String}}
 
,
 
Buttons
 
{{APIPrefix|As}}
 
MsgBoxStyle ,
 
Answer
 
{{APIPrefix|As}}
 
MsgBoxResult )
 
</li></ul>
 
 
 
Parameters
 
:''sender'': An [[ALTADataSet Class|ALTADataSet]] object.
 
  
:''sMsg'': The main display label.
+
===Parameters===
 +
''sMsg''
 +
:Required. String. The message to display.
  
:''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.
+
''Buttons''
 +
: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]).
  
:''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.
+
''Answer''
 +
: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]).
  
== Usage Example ==
+
<!--== Example ==
{{APIComment|Declare the ALTAEvents.}}<br>
+
The following example provides a simple demonstration on how to customize the event procedure.
{{APIComment|Declare the ALTADataSet.}}<br>
+
'''VBA'''
{{APIComment|Note: The ALTADataSet constructor already creates a new ALTAEvents, which could be used in place of AEvents in the example below.}}<br>
+
{{APIComment|Select a message box style. See [http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.msgboxstyle.aspx MsgBoxStyle] for additional details.}}<br>
+
{{APIComment|'Specify a variable to handle the event.}}
{{APIComment|Declare a result variable. See [http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.msgboxresult.aspx MsgBoxResult] for additional details.}}
+
  {{APIPrefix|Private WithEvents}} ads {{APIPrefix|As}} ALTADataSet
        Dim AEvents as New ALTAEvents
+
        Dim ADS as New ALTADataSet
+
{{APIComment|'----------------------------}}
        Dim MsgBoxStyle1 as MsgBoxStyle = MsgBoxStyle.OkCancel
+
  {{APIPrefix|Sub}} Main()
        Dim MsgBoxResult1 as MsgBoxResult
+
  {{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|'Define two stress types.}}
 +
    {{APIPrefix|Call}} ads.AddStressDefinition({{APIString|"Temperature"}}, , 300)
 +
    {{APIPrefix|Call}} ads.AddStressDefinition({{APIString|"Humidity"}}, , 0.3)
 +
 +
  {{APIComment|'Select to use the Temperature-Humidity model with a Weibull distribution.}}
 +
    ads.AnalysisSettings.ModelType = ALTASolverModel_TempHumidity
 +
    ads.AnalysisSettings.Distribution = ALTASolverDistribution_Weibull
 +
 +
  {{APIComment|'Trigger the event by analyzing an incomplete data set.}}
 +
    {{APIPrefix|Call}} ads.AddFailure_3(248, 1, 406, 0.5)
 +
    {{APIPrefix|Call}} ads.AddFailure_3(456, 1, 416, 0.7)
 +
    {{APIPrefix|Call}} ads.AddFailure_3(528, 1, 426, 0.9)
 +
 +
    ads.Calculate
 +
    Msgbox({{APIString|"End"}})
 +
  {{APIPrefix|End Sub}}
 +
 +
{{APIComment|'----------------------------}}
 +
  {{APIPrefix|Private Sub}} ads_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'''
        AEvents.Question(ADS, "Question1", MsgBoxStyle1, MsgBoxResult1)
+
 +
{{APIComment|'Specify a variable to handle the event.}}
 +
  {{APIPrefix|Private 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|'Define two stress types.}}
 +
    ads.AddStressDefinition({{APIString|"Temperature"}}, , 300)
 +
    ads.AddStressDefinition({{APIString|"Humidity"}}, , 0.3)
 +
 +
  {{APIComment|'Select to use the Temperature-Humidity model with a Weibull distribution.}}
 +
    ads.AnalysisSettings.ModelType = ALTASolverModel.TempHumidity
 +
    ads.AnalysisSettings.Distribution = ALTASolverDistribution.Weibull
 +
 +
  {{APIComment|'Trigger the event by analyzing an incomplete data set.}}
 +
    ads.AddFailure(248, 1, 406, 0.5)
 +
    ads.AddFailure(456, 1, 416, 0.7)
 +
    ads.AddFailure(528, 1, 426, 0.9)
 +
 +
    ads.Calculate
 +
    Msgbox({{APIString|"End"}})
 +
  {{APIPrefix|End Sub}}
 +
 +
{{APIComment|'----------------------------}}
 +
  {{APIPrefix|Private Sub}} ads_Question(''msg'' {{APIPrefix|As String}}, ''Buttons'' {{APIPrefix|As MsgBoxStyle}}, _
 +
                          {{APIPrefix|ByRef}} ''Answer'' {{APIPrefix|As MsgBoxResult}}) {{APIPrefix|Handles}} ads.Question
 +
  {{APIComment|'<Add code here to handle the event.>}}
 +
    MsgBox (msg, vbYesNoCancel)
 +
  {{APIPrefix|End Sub}}
 +
-->

Latest revision as of 00:01, 7 September 2016

APIWiki.png


Member of: SynthesisAPI.ALTADataSet

DRAFT GRAY.png

WORK IN PROGRESS
ALTADataSet.Question

DRAFT GRAY.png

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).