'WithEvents' variables can only be typed as classes, interfaces or type parameters with class constraints

You declared a variable that is typed as a structure in conjunction with WithEvents, which is not a valid use of the WithEvents modifier.

Error ID: BC30413

To correct this error

  • Use AddHandler to handle events defined in a structure.

See Also

Concepts

WithEvents and the Handles Clause

Reference

Dim Statement (Visual Basic)

AddHandler Statement