0% found this document useful (0 votes)
54 views3 pages

Simple Calculator: Coding

This document contains the code for a simple calculator application. It includes subroutines for each of the numeric buttons on the calculator which perform basic math operations like multiplication and addition on values in a Text1 text box. Additional subroutines allow for operations like logarithms, square roots, and clearing values between calculations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views3 pages

Simple Calculator: Coding

This document contains the code for a simple calculator application. It includes subroutines for each of the numeric buttons on the calculator which perform basic math operations like multiplication and addition on values in a Text1 text box. Additional subroutines allow for operations like logarithms, square roots, and clearing values between calculations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

SIMPLE CALCULATOR

CODING

Dim Op1, Op2, Op3, Op As Variant


Private Sub Command1_Click()
R = Val(Text1.Text) * 10
R=R+9
Text1.Text = R
End Sub

Private Sub Command10_Click()


R = Val(Text1.Text) * 10
R=R+0
Text1.Text = R
End Sub

Private Sub Command11_Click()


Op1 = Val(Text1.Text)
Op2 = Math.Log(Op1)
Text1.Text = Op2
End Sub

Private Sub Command12_Click()


Text1.Text = " "
Op1 = Op2 = Op3 = Op = 0
End Sub

Private Sub Command13_Click()


Op1 = Val(Text1.Text)
Text1.Text = " "
Op = "*"
End Sub

Private Sub Command14_Click()


Op1 = Val(Text1.Text)
Text1.Text = " "
Op = "/"
End Sub

Private Sub Command15_Click()


Op1 = Val(Text1.Text)
Text1.Text = " "
Op = "-"
End Sub
Private Sub Command16_Click()
Op1 = Val(Text1.Text)
Text1.Text = " "
Op = "+"
End Sub

Private Sub Command17_Click()


Op2 = Val(Text1.Text)
If Op = "+" Then
Op3 = Op1 + Op2
ElseIf Op = "-" Then
Op3 = Op1 - Op2
ElseIf Op = "*" Then
Op3 = Op1 * Op2
ElseIf Op = "/" Then
Op3 = Op1 / Op2
Else
Text1.Text = "ERROR"
End If
Text1.Text = Op3
End Sub

Private Sub Command18_Click()


Op1 = Val(Text1.Text)
Op2 = Math.Sqr(Op1)
Text1.Text = Op2
End Sub

Private Sub Command2_Click()


R = Val(Text1.Text) * 10
R=R+8
Text1.Text = R
End Sub

Private Sub Command3_Click()


R = Val(Text1.Text) * 10
R=R+7
Text1.Text = R
End Sub

Private Sub Command4_Click()


R = Val(Text1.Text) * 10
R=R+4
Text1.Text = R
End Sub
Private Sub Command5_Click()
R = Val(Text1.Text) * 10
R=R+1
Text1.Text = R
End Sub

Private Sub Command6_Click()


R = Val(Text1.Text) * 10
R=R+5
Text1.Text = R
End Sub

Private Sub Command7_Click()


R = Val(Text1.Text) * 10
R=R+6
Text1.Text = R
End Sub

Private Sub Command8_Click()


R = Val(Text1.Text) * 10
R=R+2
Text1.Text = R
End Sub

Private Sub Command9_Click()


R = Val(Text1.Text) * 10
R=R+3
Text1.Text = R
End Sub

OUTPUT

You might also like