Question

My code won't compile because it gives an error stating "Signature is not compatible" for MyDigiouts.SensorOneOn

Private Sub myDigioutsInt(ByVal src As Object, ByVal args As DiSnapEventArgs) Handles   MyDigiouts.SensorOneOn
    MsgBox("Sensor On")
End Sub

The event in the class is defined by:

Public Event SensorOneOn()
Public Event SensorOneOff()

Private Sub InstantDiCtrl1_DiCosIntPortX(ByVal src As Object, ByVal args As DiSnapEventArgs) Handles InstantDiCtrl1.ChangeOfState
    Try
        If args.SrcNum = 0 Then


            RaiseEvent SensorOneOn()
        End If

    Catch ex As System.Exception
    End Try
End Sub

The arguments seem to be the same for the event in my class as well as the handler. I'm not sure why the code says the signatures aren't compatible.

This question seems to be similar but this is all one project. Method '' cannot handle event '' because they do not have a compatible signature

How to I get the code to compile and why does it say the signatures are different?

Was it helpful?

Solution

Your events do not have any parameters.

As the error is trying to tell you, you cannot add a handler that takes parameters if the event doesn't have parameters.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top