Hey, i have to finished a cacluator, all my code seems to be working apart from the equals button and i do not understand why..i've tried several different things such as a case too but nothing seems to work to get the equals button working..please help!!
This is my code, no need for all the buttons they are the same and ive declared variables..help soon please!
Private Sub btn0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn0.Click
If btnCalculation = 1 Or btnCalculation = 2 Then
txtDisplay.Clear()
End If
txtDisplay.Text = txtDisplay.Text & btn0.Text
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
If btnCalculation = 1 Or btnCalculation = 2 Then
txtDisplay.Clear()
End If
txtDisplay.Text = txtDisplay.Text & "+"
btnCalculation = 1
Number1 = txtDisplay.text
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
If btnClear.Enabled = True Then
Number1 = 0
Number2 = 0
txtDisplay.Text = " "
End If
End Sub
Private Sub btnMinus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMinus.Click
Number1 = txtDisplay.Text
If btnCalculation = 1 Or btnCalculation = 2 Then
txtDisplay.Clear()
End If
txtDisplay.Text = txtDisplay.Text & "-"
btnCalculation = 2
End Sub
Private Sub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click
Number2 = txtDisplay.Text
If btnCalculation = 1 Then
txtDisplay.Text = Number1 + Number2
ElseIf btnCalculation = 2 Then
txtDisplay.Text = Number1 - Number2
End If
End Sub
End Class