ALTAEvents Class: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
Line 11: Line 11:


== Usage Example ==
== Usage Example ==
{{APIComment|'Create a new ALTADataSet object.}}
  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 and inherit ALTAEvents. Then set the dataset's events.}}
   Private Class myEvents
   Private Class myEvents

Revision as of 18:47, 1 April 2014


Contains all the event handlers that can be called by ALTADataSet. To use events, you must inherit the class, override its methods and assign its instance to the Events property of an ALTADataSet. ALTAEvents inheritance is not available in VB6/VBA.

Methods

Usage Example

 'Create a new ALTADataSet object. 
 Dim ADS As New ALTADataSet
 '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 As MsgBoxStyle = MsgBoxStyle.YesNoCancel
 Dim Answer As MsgBoxResult 
 
 'Ask a question. Result will be updated in Answer. 
 ADS.Events.Question(ADS, "Continue?", MsgBoxStyle1, Answer)