MessageBox does not stop your application from processing other events and it may be that a new barcode is read (or the same barcode is notified again) while you are still in the function processing the previous one. Did you try to remove the call to MessageBox and check if this is still happening? You may need to disable the reader before you call MessageBox.
Error to validate the length of a barcode read
-
09-10-2022 - |
Question
I have a project in Visual Studio 2005 with EMDK 2.6 with a MC1000 data collector over XP SP3 implemented on Windows CE. I have this function within the project that gives me an error that I can't solve :
'Handle data from the reader
Private Sub HandleData(ByVal TheReaderData As Symbol.Barcode.ReaderData)
'MsgBox("Hello I'm reading ....")
If Me.DataTextBox.Text = "" Then
Me.DataTextBox.Text = TheReaderData.Text
' Here begins the verification of the length
If Len(Me.DataTextBox.Text) = Me.TextBox6.Text Then
' The length is ok
objStreamWriter.WriteLine(Me.DataTextBox.Text)
'Update the last read
Me.Label5.Text = Me.DataTextBox.Text
'Clean the field of the current read
Me.DataTextBox.Text = ""
'The counter of the code bars reads increases +1
Me.TextBox3.Text = Me.TextBox3.Text + 1
Else
Me.DataTextBox.Text = ""
MessageBox.Show("The length of the string read is not as expected", "Error !")
End If
End If
End Sub
The problem begins when I read a barcode with a length different to Me.TextBox6.Text (24 for example), the messagebox is shows ok, but inmediatelly another message box appear with the next error: "StartRead Invalid Request Read already pending" and the program continues fine, I need to eliminate this error because looks very bad. Any help ? Thanks in advance.
No correct solution
OTHER TIPS
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow