我有两个文本框需要两个检索数据来扫描条形码。目前,我需要扫描条码两次。所以,我想只扫描条码一次。那么,有人可以帮助我这样做吗?这是我目前的代码。
Private Sub TextScanPartNo_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs) Handles TextScanPartNo.KeyPress
TextScanPartNo.CharacterCasing = CharacterCasing.Upper
Dim ProdDate As String = DateTimePicker1.Value.ToString("MM/d/yyyy")
Dim s As String
If Asc(e.KeyChar) = 13 Then
s = TextScanPartNo.Text.Split(New Char() {"|c"})(2)
TextScanPartNo.Text = s
If cls_PICS.get_PartNo(Trim(TextScanPartNo.Text)) = False Then
'TextBoxMOQ.ReadOnly = True
'CheckBox1.Enabled = False
Dim SQL_str As String =
"SELECT * " &
"FROM [mastersetup] where PartNo ='" & TextScanPartNo.Text & "'"
Dim adLWS As New SqlDataAdapter(SQL_str, cnPICS)
Dim dsLWS As New DataSet
adLWS.Fill(dsLWS, "BOXID1")
LWS_CONT = dsLWS.Tables("BOXID1").Rows.Count
Dim i As Integer
For i = 0 To LWS_CONT - 1
TextBoxMOQ.Text = dsLWS.Tables("BOXID1").Rows(i)("MOQ").ToString
TextBox3.Text = dsLWS.Tables("BOXID1").Rows(i)("Inspection").ToString
Next
Else
MsgBox("Please insert Standard Box Quantity")
End If
If cls_PICS.get_ExistingSequenceNoOld(TextScanPartNo.Text, TextBoxMOQ.Text, TextVendorID.Text) = True Then
'If cls_PICS.get_ExistingSequenceNoOld(TextScanPartNo.Text) = True Then
cls_PICS.BOXIDRunningNo(cls_PICS.BoxEnd(0))
TextStart.Text = cls_PICS.NewBox
Else
TextStart.Text = "A00001"
End If
TextBoxDelivery.Focus()
End If
End Sub
Private Sub TextBoxDelivery_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs) Handles TextBoxDelivery.KeyPress
TextBoxDelivery.CharacterCasing = CharacterCasing.Upper
Dim s As String
If Asc(e.KeyChar) = 13 Then
s = TextBoxDelivery.Text.Split(New Char() {"|c"})(5)
TextBoxDelivery.Text = s
TextBoxPQty.Text = (Int(Val(TextBoxDelivery.Text) / Val(TextBoxMOQ.Text))).ToString
TextBoxPQty.Focus()
End If
End Sub
提前谢谢。