“数量”——Text2
“折扣”——Text3
“计算”——Command1
“清除”——Command2
代码如下。
==================================
Private Sub Command1_Click()
On Error GoTo e
MsgBox "应付款" &Text1.Text * Text2.Text * (1 - Text3.Text)
Exit Sub
e:
MsgBox "数据输入错误"
End Sub
Private Sub Command2_Click()
Call Form_Load
End Sub
Private Sub text3_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyReturn
Call Command1_Click
Case vbKeyEscape
Call Form_Load
End Select
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Command1.Caption = "计算"
Command2.Caption = "清除"
End Sub
这个问题解决方案: 在文本框的 获得焦点事件中 设置成选中文本框内所以文本 就可以了 例如 现在输入框为50只要文本框获得焦点 文本框就会选中50 你直接输入120 就行了欢迎分享,转载请注明来源:内存溢出
评论列表(0条)