Template:ALTAEvents.Question.Ex: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
 
Line 4: Line 4:
   Dim ADS As New ALTADataSet
   Dim ADS As New ALTADataSet
    
    
  {{APIComment|'Overrides requested. Create a new class and inherit ALTAEvents. Then set the dataset's events.}}
  {{APIComment|'Overrides requested. Create a new class, inherit ALTAEvents, and set the dataset's events.}}
   Private Class myEvents
   Private Class myEvents
       Inherits ALTAEvents
       Inherits ALTAEvents

Latest revision as of 22:00, 5 May 2014

Usage Example

This example demonstrates how to produce a dialog box when an answer to a question is required.

 'Create a new ALTADataSet object. 
 Dim ADS As New ALTADataSet
 
 'Overrides requested. Create a new class, inherit ALTAEvents, and 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. Three buttons will be displayed. 
 Dim Buttons As MsgBoxStyle = MsgBoxStyle.YesNoCancel
 Dim Answer As MsgBoxResult 
 
 'Ask a question. Result will be updated in Answer. 
 ADS.Events.Question(ADS, "Continue?", Buttons, Answer)