'................................................
Private Sub Command1_Click()
dato = "a"
Call enviar
End Sub
'...................................................
Private Sub Command2_Click()
Call recibir
End Sub
'....................................................
Private Sub Form_Load()
With MSComm1
.CommPort = 1
.Settings = "9600,N,8,1"
.InputMode = comInputModeText
.InputLen = 0 'el control MSComm leera todo el bufer de recepcion
.PortOpen = True
End With
End Sub
'......................................................
Private Sub enviar()
MSComm1.InBufferCount = 0 'resetea el bufer de recepcion
MSComm1.Output = dato
Do While MSComm1.OutBufferCount > 0
Loop
End Sub
'......................................................................
Private Sub recibir()
Dim entrada As String
MSComm1.OutBufferCount = 0
buferentrada = MSComm1.Input
Do While MSComm1.InBufferCount > 0
Loop
Text1.Text = Text1.Text & entrada & vbCrLf
End Sub
'........................................................................