Subtracting, multiplying,dividing multiple numbers on a calculator using VB.Net 2010
<p>The calculator works when I add multiple numbers but it doesn't work when I subtract, multiply or divide multiple numbers. I'm not sure what coding I should do for these operations to work. Even if I change this line of code <code>(total1=total1 + Val(txtAnswer.Text)) to (total1=total1 - Val(txtAnswer.Text))</code> from the buttons procedure, it still doesn't work</p>

<pre><code>Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click              'Add Button
    Operation = "+"
    txtDisplay.Text = txtDisplay.Text &amp; btnAdd.Text
    txtAnswer.Text = txtAnswer.Text &amp; btnAdd.Text
    total1 = total1 + Val(txtAnswer.Text)
    txtAnswer.Clear()
End Sub

Private Sub btnMinus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMinus.Click    'Minus Button
    Operation = "-"
    txtDisplay.Text = txtDisplay.Text &amp; btnMinus.Text
    txtAnswer.Text = txtAnswer.Text &amp; btnMinus.Text
    total1 = total1 + Val(txtAnswer.Text)
    txtAnswer.Clear()
End Sub

Private Sub btnMulti_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMulti.Click   'Multiply Button
    Operation = "x"
    txtDisplay.Text = txtDisplay.Text &amp; btnMulti.Text
    txtAnswer.Text = txtAnswer.Text &amp; btnMulti.Text
    total1 = total1 + Val(txtAnswer.Text)
    txtAnswer.Clear()
End Sub

Private Sub btnDiv_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDiv.Click   'Divide Button
    Operation = "/"
    txtDisplay.Text = txtDisplay.Text &amp; btnDiv.Text
    txtAnswer.Text = txtAnswer.Text &amp; btnDiv.Text
    total1 = total1 + Val(txtAnswer.Text)
    txtAnswer.Clear()
End Sub

Private Sub btnEqu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEqu.Click
    Select Case Operation
        Case "+"
            total2 = total1 + Val(txtAnswer.Text)
            txtAnswer.Text = total2
            total1 = 0
        Case "-"
            total2 = total1 - Val(txtAnswer.Text)
            txtAnswer.Text = total2
            total1 = 0
        Case "x"
            total2 = total1 * Val(txtAnswer.Text)
            txtAnswer.Text = total2
            total1 = 0
        Case "/"
            total2 = total1 / Val(txtAnswer.Text)
            txtAnswer.Text = total2
            total1 = 0
    End Select
End Sub
</code></pre>