Hi All,
My latest question from the wonderful hacking job I am doing is 'Am I attaching the event handler right?' I am trying to get some code working, I have written bits and pieces and would like to get it all in one program. In the test bit of code I have
AddHandler myComPort.DataReceived, AddressOf port_ATE
This attaches the event handler, so when copying it over I changed the name to
AddHandler AteComPort.DataReceived, AddressOf port_ATE
I have also changed the various names as below
Private Sub port_ATE(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs)
TmrNoDataAtPortATE.Enabled = False
InputDataATE = AteComPort.ReadExisting
Reply_Status_ATE = REPLY_ATE.YES_REPLY
If InputDataATE <> [String].Empty Then
Me.BeginInvoke(New SetTextCallbackATE(AddressOf SetTextATE), New Object() {InputDataATE})
Else
MsgBox("null")
End If
TmrNoDataAtPortATE.Enabled = False
If (Reply_Status_ATE = REPLY_ATE.TIMEOUT_REPLY) Then
Data_Back_ATE = "TIMEOUT"
ElseIf (Reply_Status_ATE = REPLY_ATE.YES_REPLY) Then
TmrNoDataAtPortATE.Enabled = False
End If
End Sub
working version !
Private Sub port_ATE(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs)
NoDataAtPort.Enabled = False
InputData = myComPort.ReadExisting
Reply_Status = REPLY.YES_REPLY
If InputData <> [String].Empty Then
Me.BeginInvoke(New SetTextCallback(AddressOf SetText), New Object() {InputData})
Else
MsgBox("null")
End If
TmrNoDataAtPort.Enabled = False
If (Reply_Status = REPLY.TIMEOUT_REPLY) Then
Data_Back = "TIMEOUT"
ElseIf (Reply_Status = REPLY.YES_REPLY) Then
NoDataAtPort.Enabled = False
End If
End Sub
I think they are the same! can anyone spot a difference! Please help!!