Option Explicit
Dim a As Double
Dim b As Double
Dim op As String
Dim cleardisplay As Boolean
Private Sub add Click()
a Val (display. Text) op = “+”
display Text=””
9:53
Private Sub add Click() a Val (display, Text)
op = “+”
display. Text=””
End Sub
Private Sub clear_Click() display. Text=”
End Sub
Private Sub digit Click(Index As Integer)
If cleardisplay Then End If
display. Text= cleardisplay= False
End Sub
display. Text display. Text + digit(Index).Caption
Private Sub div_Click() a Val (display. Text) op = “/”
display. Text=””
End Sub
Private Sub dot Click() If InStr(display. Text, “” Then
Exit Sub Else display. Text display. Text”” End If
End Sub
Private Sub equal Click() Dim result As Double b= Val (display. Text) If op=”+” Then result = a+b End If End If End If
If op=”-” Then
result = a-b
If op = “” Then.
result = a*b
End If If op”/” And b <> “0” Then
result = a/b
display. Text result End Sub
Private Sub Form_Load() End Sub Private Sub mul_Click() a Val (display. Text)
op=””
display. Text=”
End Sub
Private Sub off Click() End
End Sub
Private Sub sub_Click()
a Val (display. Text)
op=
display. Text””
End Sub