I am working on barcode reading software. Runs ok, but reads at the most 8 characters at a time. How can I get it to read the entire barcode rather than in pieces?
Here is a snippet of my code
Imports System.Data.Sql Client
Imports System.IO.Ports
Public Class Form1
Private BarCodeEnabled As Boolean
'Private WithEvents ComPort As IO.Ports.Serial Port = My.Computer.Por ts.OpenSerialPo rt(Settings1.De fault.ComPort)
Dim WithEvents ComPort As New IO.Ports.Serial Port
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
If ComPort.IsOpen Then
ComPort.Close()
End If
Try
With ComPort
.PortName = "Com3"
.BaudRate = 300
.Parity = IO.Ports.Parity .None
.DataBits = 8
.StopBits = IO.Ports.StopBi ts.One
'.ReadBufferSiz e = 20
''.ReceivedByte sThreshold = 50
'.StopBits = 1
'.ReadTimeout = 100
'.Handshake = IO.Ports.Handsh ake.None
'.RtsEnable = True
'.DtrEnable = True
'.Encoding = System.Text.Enc oding.ASCII
' .Encoding = System.Text.Enc oding.Unicode
End With
ComPort.Open()
End Sub
Private Sub DataReceived( _
ByVal sender As Object, _
ByVal e As System.IO.Ports .SerialDataRece ivedEventArgs) _
Handles ComPort.DataRec eived
txtDataReceived .Invoke(New _
myDelegate(Addr essOf updateTextBox), _
New Object() {})
End Sub
Public Delegate Sub myDelegate()
Public Sub updateTextBox()
With txtDataReceived
MsgBox(ComPort. ReadExisting)
End With
End Sub
I also tried ComPort.Readlin e, but got an I/O thread error.
Your help would be greatly appreciated.
Here is a snippet of my code
Imports System.Data.Sql Client
Imports System.IO.Ports
Public Class Form1
Private BarCodeEnabled As Boolean
'Private WithEvents ComPort As IO.Ports.Serial Port = My.Computer.Por ts.OpenSerialPo rt(Settings1.De fault.ComPort)
Dim WithEvents ComPort As New IO.Ports.Serial Port
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
If ComPort.IsOpen Then
ComPort.Close()
End If
Try
With ComPort
.PortName = "Com3"
.BaudRate = 300
.Parity = IO.Ports.Parity .None
.DataBits = 8
.StopBits = IO.Ports.StopBi ts.One
'.ReadBufferSiz e = 20
''.ReceivedByte sThreshold = 50
'.StopBits = 1
'.ReadTimeout = 100
'.Handshake = IO.Ports.Handsh ake.None
'.RtsEnable = True
'.DtrEnable = True
'.Encoding = System.Text.Enc oding.ASCII
' .Encoding = System.Text.Enc oding.Unicode
End With
ComPort.Open()
End Sub
Private Sub DataReceived( _
ByVal sender As Object, _
ByVal e As System.IO.Ports .SerialDataRece ivedEventArgs) _
Handles ComPort.DataRec eived
txtDataReceived .Invoke(New _
myDelegate(Addr essOf updateTextBox), _
New Object() {})
End Sub
Public Delegate Sub myDelegate()
Public Sub updateTextBox()
With txtDataReceived
MsgBox(ComPort. ReadExisting)
End With
End Sub
I also tried ComPort.Readlin e, but got an I/O thread error.
Your help would be greatly appreciated.