5.2.3.1.2 WithEvents Variable Declarations

 

withevents-variable-dcl = "withevents" IDENTIFIER "as" class-type-name 
 
class-type-name = defined-type-expression 

Static Semantics

  • A <withevents-variable-dcl> defines a variable whose declared type is the specified type of its <class-type-name element.

  • The specified type of the <class-type-name> element MUST be a specific class that has at least one event member.

  • The specified type of <class-type-name> element MUST NOT be the class defined by the class modules containing this declaration.

    • The name value of the <IDENTIFIER with an appended underscore character (Unicode u+005F) is an event handler name prefix for the class module containing this declaration.

  • The specified type of a <class-type-name> is the declared type referenced by its <defined-type-expression.