Design window :-
Take button on form and one textbox on form and make it place as shown below and then in code window of each button do following coding.
Dim operand1 As Double
Dim operand2 As Double
Dim operator As String
Private Sub Command1_Click()
Text1.Text = Text1.Text + "1"
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 Command10_Click()
Text1.Text = Text1.Text + "0"
End Sub
Private Sub Command11_Click()
Text1.Text = Text1.Text + "."
End Sub
Private Sub Command12_Click()
Text1.Text = ""
End Sub
Private Sub Command13_Click()
operand1 = Val(Text1.Text)
operator = "+"
Text1.Text = ""
End Sub
Private Sub Command14_Click()
operand1 = Val(Text1.Text)
operator = "-"
Text1.Text = ""
End Sub
Private Sub Command15_Click()
operand1 = Val(Text1.Text)
operator = "*"
Text1.Text = ""
End Sub
Private Sub Command16_Click()
operand1 = Val(Text1.Text)
operator = "/"
Text1.Text = ""
End Sub
Private Sub Command17_Click()
Dim n As Integer
Dim fact As Integer
fact = 1
n = Val(Text1.Text)
For i = 1 To n
fact = fact * i
Next
MsgBox "Factorial of " & n & " is = " & fact
Text1.Text = ""
End Sub
Private Sub Command18_Click()
Text1.Text = Text1.Text * -1
End Sub
Private Sub Command19_Click()
Dim n As Integer
n = Val(Text1.Text)
If n Mod 2 = 0 Then
MsgBox "Number is EVEN"
Else
MsgBox "Number is ODD"
End If
Text1.Text = ""
End Sub
Private Sub Command20_Click()
Dim result As Double
operand2 = Val(Text1.Text)
If operator = "-" Then result = operand1 - operand2
If operator = "*" Then result = operand1 * operand2
If operator = "+" Then result = operand1 + operand2
If operator = "/" And operand2 <> "0" Then result = operand1 / operand2
Text1.Text = result
End Sub
=============================================================
OUTPUT
Take button on form and one textbox on form and make it place as shown below and then in code window of each button do following coding.
Dim operand2 As Double
Dim operator As String
Private Sub Command1_Click()
Text1.Text = Text1.Text + "1"
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 Command10_Click()
Text1.Text = Text1.Text + "0"
End Sub
Private Sub Command11_Click()
Text1.Text = Text1.Text + "."
End Sub
Private Sub Command12_Click()
Text1.Text = ""
End Sub
Private Sub Command13_Click()
operand1 = Val(Text1.Text)
operator = "+"
Text1.Text = ""
End Sub
Private Sub Command14_Click()
operand1 = Val(Text1.Text)
operator = "-"
Text1.Text = ""
End Sub
Private Sub Command15_Click()
operand1 = Val(Text1.Text)
operator = "*"
Text1.Text = ""
End Sub
Private Sub Command16_Click()
operand1 = Val(Text1.Text)
operator = "/"
Text1.Text = ""
End Sub
Private Sub Command17_Click()
Dim n As Integer
Dim fact As Integer
fact = 1
n = Val(Text1.Text)
For i = 1 To n
fact = fact * i
Next
MsgBox "Factorial of " & n & " is = " & fact
Text1.Text = ""
End Sub
Private Sub Command18_Click()
Text1.Text = Text1.Text * -1
End Sub
Private Sub Command19_Click()
Dim n As Integer
n = Val(Text1.Text)
If n Mod 2 = 0 Then
MsgBox "Number is EVEN"
Else
MsgBox "Number is ODD"
End If
Text1.Text = ""
End Sub
Private Sub Command20_Click()
Dim result As Double
operand2 = Val(Text1.Text)
If operator = "-" Then result = operand1 - operand2
If operator = "*" Then result = operand1 * operand2
If operator = "+" Then result = operand1 + operand2
If operator = "/" And operand2 <> "0" Then result = operand1 / operand2
Text1.Text = result
End Sub
=============================================================
OUTPUT