Argument matching parameter narrows to 'System.EventHandler'

653 Views Asked by At

During a refactor of some code, I've started getting this error. As far as I can tell I haven't changed anything that would affect this, nor have I changed the method signature.

Here is the method:

Public Sub DisplayMessage(msg as String, callBack As System.EventHandler) Implements IMyInterface.DisplayMessage

    ...

End Sub

And here's how it's called:

MessageInstance.DisplayMessage("test", _
    AddressOf MyFunc)

And MyFunc is just:

Private Sub MyFunc()
   ...
End Sub

I currently have two versions of the code, the refactored one is giving the compile error:

Argument matching parameter 'callBack' narrows to 'System.EventHandler'

And the previous version is not.

The only change that has been made to this is that the the DisplayMessage function, and the MessageInstance class has move into a separate library. Can anyone provide an explanation as to why this error is occurring or, preferably, why it is NOW occurring?

0

There are 0 best solutions below