Hi,
I've this procedure
and I need to addhandler for it
but always get an error for the AddHandler line
Error 1 Method 'Private Sub ClientSocket_Wr iteCompleted(se nder As Object, e As System.Componen tModel.AsyncCom pletedEventArgs )' does not have a signature compatible with delegate 'Delegate Sub Action(Of System.Componen tModel.AsyncCom pletedEventArgs )(obj As System.Componen tModel.AsyncCom pletedEventArgs )'.
It will only work if i change the procedure to
Can anyone tell me what is wrong with the original code and how to solve it instead of removing the sender As Object in the procedure.
Thanks.
I've this procedure
Code:
Private Sub ClientSocket_WriteCompleted(ByVal sender As Object, ByVal e As AsyncCompletedEventArgs) ... End Sub
Code:
Private Sub buttonConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttonConnect.Click ........ ClientSocket = New SimpleClientTcpSocket() AddHandler ClientSocket.WriteCompleted, AddressOf ClientSocket_WriteCompleted End Sub
but always get an error for the AddHandler line
Error 1 Method 'Private Sub ClientSocket_Wr iteCompleted(se nder As Object, e As System.Componen tModel.AsyncCom pletedEventArgs )' does not have a signature compatible with delegate 'Delegate Sub Action(Of System.Componen tModel.AsyncCom pletedEventArgs )(obj As System.Componen tModel.AsyncCom pletedEventArgs )'.
It will only work if i change the procedure to
Code:
Private Sub ClientSocket_WriteCompleted(ByVal e As AsyncCompletedEventArgs) ... End Sub
Can anyone tell me what is wrong with the original code and how to solve it instead of removing the sender As Object in the procedure.
Thanks.
Comment