write a program to create a basic calculator in visual basic.
Anonymous:
which languagen
Answers
Answered by
0
Answer:
Private Sub Command1_Click()
Dim ans, n1, n2 As Integer
n1 = Val(txt1.Text)
n2 = Val(txt2.Text)
ans = n1 + n2
txtans.Text = ans
End Sub
Private Sub Command2_Click()
Dim ans, n1, n2 As Integer
n1 = Val(txt1.Text)
n2 = Val(txt2.Text)
ans = n1 - n2
txtans.Text = ans
End Sub
Private Sub Command3_Click()
Dim ans, n1, n2 As Integer
n1 = Val(txt1.Text)
n2 = Val(txt2.Text)
ans = n1 * n2
txtans.Text = ans
End Sub
Private Sub Command4_Click()
Dim ans, n1, n2 As Integer
n1 = Val(txt1.Text)
n2 = Val(txt2.Text)
ans = n1 / n2
txtans.Text = ans
End Sub
Private Sub Command6_Click()
txt1.Text = ""
txt2.Text = ""
txtans.Text = ""
End Sub
Similar questions
Chemistry,
1 month ago
Computer Science,
3 months ago
Math,
3 months ago
Physics,
10 months ago
Hindi,
10 months ago