Public Class Form1 Dim total1 As Integer Dim total2 As Integer Private Sub btnOne_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOne.Click txtDisplay.Text = txtDisplay.Text & btnOne.Text End Sub Private Sub btnTwo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTwo.Click txtDisplay.Text = txtDisplay.Text & btnTwo.Text End Sub Private Sub btnThree_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThree.Click txtDisplay.Text = txtDisplay.Text & btnThree.Text End Sub Private Sub btnFour_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFour.Click txtDisplay.Text = txtDisplay.Text & btnFour.Text End Sub Private Sub btnFive_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFive.Click txtDisplay.Text = txtDisplay.Text & btnFive.Text End Sub Private Sub btnSix_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSix.Click txtDisplay.Text = txtDisplay.Text & btnSix.Text End Sub Private Sub btnSeven_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSeven.Click txtDisplay.Text = txtDisplay.Text & btnSeven.Text End Sub Private Sub btnEight_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEight.Click txtDisplay.Text = txtDisplay.Text & btnEight.Text End Sub Private Sub btnNine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNine.Click txtDisplay.Text = txtDisplay.Text & btnNine.Text End Sub Private Sub btnZero_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnZero.Click txtDisplay.Text = txtDisplay.Text & btnZero.Text End Sub Private Sub cmdPlus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPlus.Click total1 = total1 + Val(txtDisplay.Text) txtDisplay.Clear() End Sub Private Sub cmdEquals_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEquals.Click total2 = total1 + Val(txtDisplay.Text) txtDisplay.Text = total2 total1 = 0 End Sub Private Sub cmdClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClear.Click txtDisplay.Clear() End Sub Private Sub cmdMinus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdMinus.Click total1 = total1 - Val(txtDisplay.Text) txtDisplay.Clear() End SubEnd Class
Private Sub cmdEquals_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEquals.Click total2 = total1 + Val(txtDisplay.Text) txtDisplay.Text = total2 total1 = 0
Dim total3 As Integer
Private Sub cmdMinus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdMinus.Click total3 = total3 - Val(txtDisplay.Text) txtDisplay.Clear() End Sub