📄 pos机vb代码.txt
字号:
'操作程序使用说明
'单价、数量、实收金额的值只响应数字输入,当输入非法时,弹出对话框提示重新输入
'输入的过程中,通过使用回车键完成相应的文本框之间的跳换
'单价、数量的文本框可重复使用,相应的数据记录在右面的“小票”框内
'单品输入完成后,按下“合计”按钮进行付款项的操作
Option Explicit
Public a As Double, b As Double, c As Double, c1 As Double, d As Double, e As Double '在文本框输入完数据后,用“回车”键完成相应文本框的跳换
Private Sub Command1_Click()
Label6.Caption = c1
Text3.SetFocus
Picture1.AutoRedraw = True
Picture1.ForeColor = RGB(255, 0, 0)
Picture1.Print "合计"; Label6.Caption & Chr(13);
End Sub
Private Sub Form_Activate()
Text1.SetFocus
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Select Case IsNumeric(Text1.Text) '判断输入的是否为数字
Case True
a = Text1.Text
Text2.SetFocus
Case Else
Text1.Text = ""
MsgBox "请输入数字"
Text1.SetFocus
End Select
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Select Case IsNumeric(Text2.Text) '判断输入的是否为数字
Case True
b = Text2.Text
c = a * b
c1 = c1 + c '计算应付款项
Label4.Caption = c
Picture1.AutoRedraw = True
Picture1.ForeColor = RGB(255, 0, 0)
Picture1.Print "商品", Text1.Text, Text2.Text, Label4.Caption
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Case Else
Text2.Text = ""
MsgBox "请输入数字"
Text2.SetFocus
End Select
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Select Case IsNumeric(Text3.Text) '判断输入的是否为数字
Case True
d = Text3.Text
e = d - c1
If (e < 0) Then
Text3.Text = ""
MsgBox "金额不足!"
Text3.SetFocus
End If
Label5.Caption = e
'Picture1.AutoRedraw = True
Picture1.ForeColor = RGB(255, 0, 0)
Picture1.Print "找零"; Label5.Caption & Chr(13);
Case Else
Text3.Text = ""
MsgBox "请输入正确的金额!"
Text3.SetFocus
End Select
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -