Statement recursively calls the containing 'AddHandler' for event '<eventname>'

The statements in the AddHandler accessor of an event definition must not reference the event directly.

The recommended approach is to store the list of the event's handlers as a private field in the class, structure, or module that defined the event. For more information, see How to: Declare Events That Avoid Blocking and How to: Declare Events That Conserve Memory Use.

Error ID: BC41998

To correct this error

  • Rewrite the event definition to avoid recursion.

See Also

Tasks

How to: Declare Events That Avoid Blocking

How to: Declare Events That Conserve Memory Use

Reference

AddHandler

Event Statement