WeibullDataSet.Question: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 42: Line 42:
         Private Class myEvents
         Private Class myEvents
             Inherits WeibullEvents
             Inherits WeibullEvents
             Public Overrides Sub Message(sender As WeibullDataSet, sMsg As String, AdditionalInfo As String, IsCritical As Boolean)
             Public Overrides Sub Question(sender As SynthesisAPI.WeibullDataSet, sMsg As String, Buttons As MsgBoxStyle, ByRef Answer As MsgBoxResult)
                 MyBase.Message(sender, sMsg, AdditionalInfo, IsCritical)
                 MyBase.Question(sender, sMsg, Buttons, Answer)
                 {{APIComment|(Add additional code.)}}
                 MessageBox.Show("Additional overridden code here.")
             End Sub
             End Sub
         End Class
         End Class

Revision as of 21:43, 9 October 2013



Display a prompt, and returns the result.

Method Syntax

Question( ByVal sender As WeibullDataSet, ByVal sMsg As String , ByVal Buttons As MsgBoxStyle, ByRef Answer As MsgBoxResult)
Called by ‘sender’ when an answer to the question is required.

Parameters

sender An WeibullDataSet object

sMsg The main display label.

Buttons The MsgBoxStyle that determines the number and display of the buttons. See MsgBoxStyle for additional details.

Answer The MsgBoxResult that is returned by the prompt. See MsgBoxResult for additional details.

Usage Example

Declare a New class that Inherits from WeibullEvents.
Override the method.

       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

Declare the WeibullDataSet.

       Dim WDS as New WeibullDataSet

Use the created myEvents class in place of the one created by the dataset.

       WDS.Events = New myEvents


Select a message box style. See MsgBoxStyle for additional details.
Declare a result variable. See MsgBoxResult for additional details.

       Dim MsgBoxStyle1 as MsgBoxStyle = MsgBoxStyle.OkCancel
       Dim MsgBoxResult1 as MsgBoxResult

Prompts user with "Question1" and returns result in MsgBoxResult1.

       WEvents.Question(WDS, "Question1", MsgBoxStyle1, MsgBoxResult1)