Vb.net 验证条形码读取长度时出错
我在VisualStudio2005中有一个项目,EMDK 2.6在WindowsCE上实现了一个基于XP SP3的MC1000数据采集器。 我在项目中有一个功能,它给了我一个我无法解决的错误:Vb.net 验证条形码读取长度时出错,vb.net,visual-studio-2005,windows-ce,Vb.net,Visual Studio 2005,Windows Ce,我在VisualStudio2005中有一个项目,EMDK 2.6在WindowsCE上实现了一个基于XP SP3的MC1000数据采集器。 我在项目中有一个功能,它给了我一个我无法解决的错误: 'Handle data from the reader Private Sub HandleData(ByVal TheReaderData As Symbol.Barcode.ReaderData) 'MsgBox("Hello I'm reading ....") If Me.DataTextBo
'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
当我读取长度与我不同的条形码时,问题就开始了。TextBox6.Text(例如24),messagebox显示ok,但同时另一个消息框显示下一个错误:
“StartRead无效请求读取已挂起”
程序继续运行良好,我需要消除这个错误,因为它看起来非常糟糕。
有什么帮助吗?
提前感谢。MessageBox不会阻止您的应用程序处理其他事件,可能是在您仍在处理前一个条形码的功能中时读取了新的条形码(或再次通知相同的条形码)。 您是否尝试删除对MessageBox的调用并检查是否仍在进行? 在调用MessageBox之前,您可能需要禁用读卡器