Private Sub MSComm1_OnComm ()
Select Case MSComm1.CommEvent
' Handle each event or error by placing
' code below each case statement
' Errors
Case comEventBreak ' A Break was received.
Case comEventFrame ' Framing Error
Case comEventOverrun ' Data Lost.
Case comEventRxOver ' Receive buffer overflow.
Case comEventRxParity ' Parity Error.
Case comEventTxFull ' Transmit buffer full.
Case comEventDCB ' Unexpected error retrieving DCB]
' Events
Case comEvCD ' Change in the CD line.
Case comEvCTS ' Change in the CTS line.
Case comEvDSR ' Change in the DSR line.
Case comEvRing ' Change in the Ring Indicator.
Case comEvReceive ' Received RThreshold # of
' chars.
'Guardar byte recibido en buffer temporal
TempBuffer = TempBuffer & MSComm1.Input
'Buscar si el byte recibido coincide es el retorno de carro que decidiste poner.
'Si lo es, eliminarlo del buffer temporal
if right(TempBuffer,1) = chr(26) then tempbuffer = left(tempbuffer,len(tempbuffer)-1) : Msgbox "Cadena Recibida: " & tempbuffer
Case comEvSend ' There are SThreshold number of
' characters in the transmit
' buffer.
Case comEvEof ' An EOF charater was found in
' the input stream
End Select
End Sub