You are on page 1of 2

Form1 - 1

Dim f, s, r, exp As Integer

Private Sub C_Click() ' Command Button For Clear Text


Text1.Text = " "
End Sub

Private Sub Command10_Click()


Text1.Text = Text1.Text + "0"
End Sub
Private Sub Command1_Click()
Text1.Text = Text1.Text + "1"
End Sub

Private Sub Command11_Click()


Text1.Text = Text1.Text + "."
End Sub

Private Sub Command2_Click()


Text1.Text = Text1.Text + "2"
End Sub

Private Sub Command3_Click()


Text1.Text = Text1.Text + "3"
End Sub

Private Sub Command4_Click()


Text1.Text = Text1.Text + "4"
End Sub

Private Sub Command5_Click()


Text1.Text = Text1.Text + "5"
End Sub

Private Sub Command6_Click()


Text1.Text = Text1.Text + "6"
End Sub

Private Sub Command7_Click()


Text1.Text = Text1.Text + "7"
End Sub

Private Sub Command8_Click()


Text1.Text = Text1.Text + "8"
End Sub

Private Sub Command9_Click()


Text1.Text = Text1.Text + "9"
End Sub

Private Sub divide_Click() 'Retaining First Value for the Later Operation
f = Val(Text1.Text)
Text1.Text = " "
exp = 4
End Sub

Private Sub multiply_Click() 'Retaining First Value for the Later Operation
f = Val(Text1.Text)
Text1.Text = " "
exp = 3
End Sub

Private Sub subtract_Click() 'Retaining First Value for the Later Operation
f = Val(Text1.Text)
Text1.Text = " "
exp = 2
End Sub

Private Sub sum_Click() 'Retaining First Value for the Later Operation
f = Val(Text1.Text)
Text1.Text = " "
exp = 1
End Sub
Form1 - 2

Private Sub result_Click() 'Main Working is here, First we are saving the second Value then e
valuvating
s = Val(Text1.Text)
If exp = 1 Then
r = f + s
ElseIf exp = 2 Then
r = f - s
ElseIf exp = 3 Then
r = f * s
ElseIf exp = 4 Then
r = f / s
End If

Text1.Text = r 'Displaying the Result in the Same Text Box


End Sub

You might also like