改到keydown事件
If e.keycode = 13 Then
Dim Tx As WinForm.DropDownBox = e.Sender
If Tx.Text.Length = 6 Then
Dim r1 As Row = Tables("销售订单.销售明细").AddNew()
r1("商品编号")= Tx.Text
Tx.Text= Nothing
Dim dr As Row = Tables("销售订单").Current
Dim n1 As Double = Tables("销售订单.销售明细").DataTable.Compute("Sum(总额)","销售单号='" & dr("销售单号") & "'")
e.Form.Controls("销售单号").Text = "销售单号 : " & dr("销售单号")
e.Form.Controls("销售日期").Text = "销售日期 : " & dr("销售日期")
e.Form.Controls("销售员").Text = "销售员 : " & dr("销售员")
e.Form.Controls("客户编号").Text = "客户编号 : " & dr("客户编号")
e.Form.Controls("客户姓名").Text = "客户姓名 : " & dr("客户姓名")
e.Form.Controls("客户电话").Text = "客户电话 : " & dr("客户电话")
e.Form.Controls("合计").Text = "合计 : " & n1 & "元"
Dim i As Integer = Tables("销售订单.销售明细").DataTable.Compute("Count(销售单号)","销售单号='" & dr("销售单号") & "'")
End If
If Tx.Text.Length = 12 Then
Dim r1 As Row = Tables("销售订单.销售明细").AddNew()
r1("商品条码")= Tx.Text
Tx.Text= Nothing
Dim dr As Row = Tables("销售订单").Current
Dim n1 As Double = Tables("销售订单.销售明细").DataTable.Compute("Sum(总额)","销售单号='" & dr("销售单号") & "'")
e.Form.Controls("销售单号").Text = "销售单号 : " & dr("销售单号")
e.Form.Controls("销售日期").Text = "销售日期 : " & dr("销售日期")
e.Form.Controls("销售员").Text = "销售员 : " & dr("销售员")
e.Form.Controls("客户编号").Text = "客户编号 : " & dr("客户编号")
e.Form.Controls("客户姓名").Text = "客户姓名 : " & dr("客户姓名")
e.Form.Controls("客户电话").Text = "客户电话 : " & dr("客户电话")
e.Form.Controls("合计").Text = "合计 : " & n1 & "元"
Dim i As Integer = Tables("销售订单.销售明细").DataTable.Compute("Count(销售单号)","销售单号='" & dr("销售单号") & "'")
End If
If Tx.Text.Length = 13 Then
Dim r1 As Row = Tables("销售订单.销售明细").AddNew()
r1("商品条码")= Tx.Text
Tx.Text= Nothing
Dim dr As Row = Tables("销售订单").Current
Dim n1 As Double = Tables("销售订单.销售明细").DataTable.Compute("Sum(总额)","销售单号='" & dr("销售单号") & "'")
e.Form.Controls("销售单号").Text = "销售单号 : " & dr("销售单号")
e.Form.Controls("销售日期").Text = "销售日期 : " & dr("销售日期")
e.Form.Controls("销售员").Text = "销售员 : " & dr("销售员")
e.Form.Controls("客户编号").Text = "客户编号 : " & dr("客户编号")
e.Form.Controls("客户姓名").Text = "客户姓名 : " & dr("客户姓名")
e.Form.Controls("客户电话").Text = "客户电话 : " & dr("客户电话")
e.Form.Controls("合计").Text = "合计 : " & n1 & "元"
Dim i As Integer = Tables("销售订单.销售明细").DataTable.Compute("Count(销售单号)","销售单号='" & dr("销售单号") & "'")
End If
e.cancel = true
e.sender.selectall
end if