The Code is as follows:
Copy codeThe Code is as follows :/**
* Author: wuniao heart
* Version: 1.0
*/
Dim IntX As Double global variable, used to store the calculated value
Dim operation peration As double' mark Operation Type
Dim isBegin As Boolean 'indicates whether IntX has been assigned a value.
Public Sub Clear () 'clear command function
Screen. Caption = ""
End Sub
Public Sub SavaToIntX ()
Select Case when peration
Case 1 'addition
If isBegin = False Then
IntX = Val (screen. Caption)
IsBegin = True
Else
IntX = IntX + Val (screen. Caption)
End If
Case 2 'subtraction
If isBegin = False Then
IntX = Val (screen. Caption)
IsBegin = True
Else
IntX = IntX-Val (screen. Caption)
End If
Case 3 'multiplication
If isBegin = False Then
IntX = Val (screen. Caption)
IsBegin = True
Else
IntX = IntX * Val (screen. Caption)
'Screen. Caption = IntX
End If
Case 4 'division
If isBegin = False Then
IntX = Val (screen. Caption)
IsBegin = True
Else
IntX = IntX/Val (screen. Caption)
End If
End Select
End Sub
Private Sub Command0_Click ()
Screen. Caption = screen. Caption & 0
End Sub
Private Sub commandementclick ()
Screen. Caption = screen. Caption & 1
End Sub
Private Sub Command2_Click ()
Screen. Caption = screen. Caption & 2
End Sub
Private Sub Command3_Click ()
Screen. Caption = screen. Caption & 3
End Sub
Private Sub Command4_Click ()
Screen. Caption = screen. Caption & 4
End Sub
Private Sub Command5_Click ()
Screen. Caption = screen. Caption & 5
End Sub
Private Sub Command6_Click ()
Screen. Caption = screen. Caption & 6
End Sub
Private Sub Command7_Click ()
Screen. Caption = screen. Caption & 7
End Sub
Private Sub Command8_Click ()
Screen. Caption = screen. Caption & 8
End Sub
Private Sub Command9_Click ()
Screen. Caption = screen. Caption & 9
End Sub
Private Sub CommandClear_Click () 'clear command
IsBegin = False
Operation peration = 0
IntX = 0
Screen. Caption = ""
End Sub
Private Sub CommandEqual_Click () 'equal sign operation
If operation peration <> 0 then' has operation mark
Call SavaToIntX
Operation peration = 0
IsBegin = False
Screen. Caption = IntX
End If
End Sub
Private Sub CommandMinus_Click () 'subtraction
If operation peration <> 0 then' has operation mark
Call SavaToIntX
Operation peration = 2
Call Clear
Else
Operation peration = 2
Call SavaToIntX
Call Clear
End If
End Sub
Private Sub CommandMultiple_Click () 'multiplication
If operation peration <> 0 then' has operation mark
Call SavaToIntX
Operation peration = 3
Call Clear
Else
Operation peration = 3
Call SavaToIntX
Call Clear
End If
End Sub
Private Sub CommandPlus_Click () 'addition operation
If operation peration <> 0 then' has operation mark
Call SavaToIntX
Operation peration = 1
Call Clear
Else
Operation peration = 1
Call SavaToIntX
Call Clear
End If
End Sub
Private Sub CommandSlash_Click () 'division operation
If operation peration <> 0 then' has operation mark
Call SavaToIntX
Operation peration = 4
Call Clear
Else
Operation peration = 4
Call SavaToIntX
Call Clear
End If
End Sub