Teklynx Discover ActiveX Programmer's Manual page 20

Table of Contents

Advertisement

Chapter 1 -- 12
A WithEvents variable cannot be a generic object variable.
S
That is, you cannot declare it As Object - you must specify
the class name when you declare the variable.
You cannot declare a WithEvents variable As New. The
S
event source object must be explicitly created and assigned
to the WithEvents variable.
You cannot declare WithEvents variables in a standard mod-
S
ule. You can declare them only in class modules, form mod-
ules, and other modules that define classes.
You cannot create arrays of WithEvents variables.
S
" " " " Writing code to handle an event
As soon as you declare a variable WithEvents, the variable
name appears in the left-hand drop down of the module's code
window. When you select MyDoc, the Document class events
will appear in the right-hand drop down, as shown in Figure 2
below:
Figure 2 An event associated with a WithEvents variable
Selecting an event will display the corresponding event
procedure, with the prefix MyDoc_. All the event procedures
associated with a WithEvents variable will have the variable
name as a prefix.
Programmer's Guide

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents