I am new in programming, I am trying to develop a simple calculator but I am unable to connect the addition, subtraction and equal sign buttons. Please I need your help.This is the code I used
Public Class Form1
Private Sub txtDisplay_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDisplay.TextChanged
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 cmdEqual_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEqual.Click
total2 = total1 + Val(txtDisplay.Text)
End Sub
Private Sub cmdClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClear.Click
End Sub
Private Sub btnOne_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOne.Click
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 = btnTwo.Text
End Sub
Private Sub btnThree_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThree.Click
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 = btnFour.Text
End Sub
Private Sub btnFive_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFive.Click
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 = btnSix.Text
End Sub
Private Sub btnSeven_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSeven.Click
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 = btnEight.Text
End Sub
Private Sub btnNine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNine.Click
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 = btnZero.Text
End Sub
End Class
Public Class Form1
Private Sub txtDisplay_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDisplay.TextChanged
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 cmdEqual_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEqual.Click
total2 = total1 + Val(txtDisplay.Text)
End Sub
Private Sub cmdClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClear.Click
End Sub
Private Sub btnOne_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOne.Click
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 = btnTwo.Text
End Sub
Private Sub btnThree_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThree.Click
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 = btnFour.Text
End Sub
Private Sub btnFive_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFive.Click
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 = btnSix.Text
End Sub
Private Sub btnSeven_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSeven.Click
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 = btnEight.Text
End Sub
Private Sub btnNine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNine.Click
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 = btnZero.Text
End Sub
End Class