'AddHandler', 'RemoveHandler' and 'RaiseEvent' method parameters cannot be declared '<modifier>'

The parameters of the AddHandler, RemoveHandler, and RaiseEvent methods cannot be declared with the Optional or ParamArray modifiers.

The Optional or ParamArray modifiers are allowed only on parameters in Declare, Function, Property, and Sub declarations.

Error ID: BC31138

To correct this error

  • Remove the Optional or ParamArray keyword from the parameter list.

See Also

Reference

Event Statement

AddHandler

RemoveHandler

RaiseEvent

Optional (Visual Basic)

ParamArray

Other Resources

Events in Visual Basic