I have this interface
Interface IProDataSource
Delegate Sub DstartingHandler(ByVal sender As Object, ByVal e As EventArgs)
Event starting_Sinc As DstartingHandler
End Interface
Trying to use the interface like this
Public Class DataSource : Implements IProDataSource
Public Event starting_Sinc As DstartingHandler Implements IProDataSource.starting_Sinc
Public Delegate Sub DstartingHandler(ByVal sender As Object, ByVal e As EventArgs)
End Class
Gives me the next error
Event ‘starting_Sinc’ cannot implement
event ‘starting_Sinc’ on interface
‘IProDataSource’ because their
delegate types ‘DstartingHandler’ and
‘IProDataSource.DstartingHandler’ do
not match.
You’ll need to move the delegate declaration outside of the interface and declare it public. All types used by an interface must be public when the class that implements them is public. Necessarily so or the client code could never assign the event. Thus:
If you limit the accessibility of the class you can use your original approach: