Skip to content

Instantly share code, notes, and snippets.

@LuisHCK
Created October 16, 2016 01:06
Show Gist options
  • Save LuisHCK/22c8798106006463265636b3b7108355 to your computer and use it in GitHub Desktop.
Save LuisHCK/22c8798106006463265636b3b7108355 to your computer and use it in GitHub Desktop.
Private Sub rpcAbrirPuerto()
Try
If SerialPort1.IsOpen Then
SerialPort1.Close()
End If
With SerialPort1
.PortName = "COM1"
.BaudRate = 9600
.Parity = IO.Ports.Parity.None
.DataBits = 8
.StopBits = IO.Ports.StopBits.One
End With
SerialPort1.Open()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Public Delegate Sub myDelegate()
Public Sub updateTextBox()
With txtBarCode
.ResetText()
.AppendText(SerialPort1.ReadLine)
.ScrollToCaret()
End With
MsgBox("updatebox")
End Sub
Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
txtBarCode.Text = SerialPort1.ReadExisting
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment