Difference between revisions of "ALTADataSet.Question"

From ReliaWiki
Jump to navigation Jump to search
Line 28: Line 28:
  
 
== Usage Example ==
 
== Usage Example ==
 +
{{APIComment|'Overrides requested. Create a new class and inherit ALTAEvents. Then set the dataset's Events.}}
 +
  Private Class myEvents
 +
      Inherits ALTAEvents
 +
      Public Overrides Sub Question(sender As ALTADataSet, 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.}}
 +
  ADS.Events = New myEvents
 +
 
 +
{{APIComment|'Initialize the MsgBoxStyle and MsgBoxResult variables.}}
 +
  Dim MsgBoxStyle1 = New MsgBoxStyle.YesNoCancel
 +
  Dim Answer = New MsgBoxResult
 +
 +
{{APIComment|'Ask a question. Result will be updated in Answer.}}
 +
  ADS.Events.Question(ADS, "Continue?", MsgBoxStyle1, Answer)
 +
<!--
 +
 +
 +
 +
 +
 +
 
{{APIComment|Declare the ALTAEvents.}}<br>
 
{{APIComment|Declare the ALTAEvents.}}<br>
 
{{APIComment|Declare the ALTADataSet.}}<br>
 
{{APIComment|Declare the ALTADataSet.}}<br>
Line 37: Line 61:
 
         Dim MsgBoxStyle1 as MsgBoxStyle = MsgBoxStyle.OkCancel
 
         Dim MsgBoxStyle1 as MsgBoxStyle = MsgBoxStyle.OkCancel
 
         Dim MsgBoxResult1 as MsgBoxResult
 
         Dim MsgBoxResult1 as MsgBoxResult
 
+
 
 
{{APIComment|Prompts user with "Question1" and returns result in MsgBoxResult1.}}
 
{{APIComment|Prompts user with "Question1" and returns result in MsgBoxResult1.}}
 
         AEvents.Question(ADS, "Question1", MsgBoxStyle1, MsgBoxResult1)
 
         AEvents.Question(ADS, "Question1", MsgBoxStyle1, MsgBoxResult1)
 +
-->

Revision as of 18:41, 1 April 2014


Called when an answer to a question is required. Displays a prompt and returns the result.

Syntax

  • Question( sender As ALTADataSet, sMsg As String , Buttons As MsgBoxStyle , Answer As MsgBoxResult )

Parameters

sender: An ALTADataSet 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

 'Overrides requested. Create a new class and inherit ALTAEvents. Then set the dataset's Events. 
 Private Class myEvents
     Inherits ALTAEvents
     Public Overrides Sub Question(sender As ALTADataSet, sMsg As String, Buttons As MsgBoxStyle, ByRef Answer As MsgBoxResult)
         MyBase.Question(sender, sMsg, Buttons, Answer)
             '<Add additional code here.> 
     End SubEnd Class
 
 'Set the new events class. 
 ADS.Events = New myEvents
 
 'Initialize the MsgBoxStyle and MsgBoxResult variables. 
 Dim MsgBoxStyle1 = New MsgBoxStyle.YesNoCancel
 Dim Answer = New MsgBoxResult 
 'Ask a question. Result will be updated in Answer. 
 ADS.Events.Question(ADS, "Continue?", MsgBoxStyle1, Answer)