'Text1输入,Text2结果
Private Sub Text1_KeyPress(KeyAscii As Integer)
Static int1 As Integer
Debug.Print KeyAscii '45-,43+
If KeyAscii = 45 Or KeyAscii = 43 Then
'+,-
If int1 = 0 Then
Text2.Text = Val(Text1.Text)
Else
Text2.Text = Val(Text2.Text) + int1 * Val(Text1.Text)
End If
Text1.Text = ""
int1 = (44 - KeyAscii)
KeyAscii = 0
ElseIf (KeyAscii < 48 Or KeyAscii > 57) Then
KeyAscii = 0 '取消输入
Else
End If
End Sub老师,小数点的功能和回车的功能还没有实现呢!再请教一下,谢谢了!退格键的功能也没有实现。
