Wednesday, September 19, 2007

Symbol Scanner CE code - StartRead()

The CE app that I'm working is for a Symbol scanner, and I ran into an "Read already pending" error message when attempting to scan a third barcode into the form. It is completely beyond me why it only errors out the third time, and does not error out on the second read. It was only happening on one form, and I finally chased it down to the fact that the problem form was the only one missing error handling. An update as shown below "fixed"* the problem.

Private Sub StartRead()
'If we have both a reader and a reader data
If Not ((Me.MyReader Is Nothing) And (Me.MyReaderData Is Nothing)) Then
'Submit a read
AddHandler MyReader.ReadNotify, Me.MyEventHandler

Try
Me.MyReader.Actions.Read(Me.MyReaderData)
Catch ex As Exception
End Try
End If
End Sub



*The root cause is not fixed, but I don't really have any good reasons to go any further into fixing the root cause.

No comments: