Generic WithEvents
Posted
by serhio
on Stack Overflow
See other posts from Stack Overflow
or by serhio
Published on 2010-03-09T11:39:18Z
Indexed on
2010/03/09
11:51 UTC
Read the original article
Hit count: 306
Error:
'WithEvents' variables can only be typed as classes, interfaces or type parameters with class constraints
Background:
Public Class Tadpole(Of T As IVisibleChanged, P As IVisibleChanged)
Private WithEvents _Tad As T ' ERROR '
Private WithEvents _Pole As P ' ERROR '
Public Property Tad() As T ...
Public Property Pole() As P ...
End Class
''' IVisibleChanged '''
Public Interface IVisibleChanged
Property Visible() As Boolean
Event VisibleChanged As EventHandler
End Interface
Workaround:
a. Use AddHandler
to handle events defined in a structure.
EDIT
b. use Private WithEvents _Tad As
IVisibleChanged
(M.A. Hanin)
c. ?
© Stack Overflow or respective owner