VBC09325 — Invalid event name
Severity: Error · Family: VBC (static semantics / abstract syntax tree) ·
Source metadata: VBCompileErrorInfo
The name of an Event declaration contains an underscore.
MS-VBAL §5.2.4.3 Event Declaration
forbids an underscore (U+005F) in the name of an event. An event is handled by a procedure named
VariableName_EventName, and the underscore is where the variable's name ends: a name with one in it would be ambiguous.
This code is raised by
ClassModuleEventSemantics. The verbose detail
names the event.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
| An event name has an underscore. | Public Event Data_Changed() |
Rename the event without it: Public Event DataChanged(). |
Notes
The same module may not declare two events of one name either, whatever the case; the second is reported as a duplicate
declaration (VBC09303).
An event name can be the name of a module variable, constant, enum member or procedure of the same module.
See also
- VBC09324 — a
WithEventsvariable of a type that cannot raise events - VBC09326 — a procedure named for an event is not a valid handler
- RD-VBAL §2.6.2 Semantic Compilation Errors
- RD-VBAL §5.2.4.3 Event Declaration
⏮️ VBC09324 Invalid type for WithEvents variable | ⏭️ VBC09326 Invalid event handler
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca