Calculating Totals From Previous Entries VB
<p>So I'm trying to calculate the total amount of an account by adding or subtracting the amount that the user places in the amountTextBox depending on what it is (deposits are added to the account total, checks are subtracted, and service charges are subtracted). However, when I go to do this in Visual Studio 2010 (since that's the program I'm required to use), the amounts for the subtracted types show up as negative and not just subtracted for the total. It isn't creating a total of the deposit and then subtracting from that; it's just subtracting from zero and adding to zero. I know my code is wrong, but I have no idea how to fix it or what to write to fix it. I also need the if/else statements in order for it to be correct.</p>

<pre><code>Public Class Form1

Private Sub clearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clearButton.Click
    'Clear all textboxes and total variable

    amountTextBox.Clear()
    totalTextBox.Clear()
End Sub

Private Sub exitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click
    'Close the program

    Me.Close()
End Sub

Private Sub printButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles printButton.Click
    'Print the program

    PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
    PrintForm1.Print()
End Sub

Private Sub calculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculateButton.Click
    'Create variables

    Dim totalAmount As Decimal
    Dim depositAmount As Decimal
    Dim checkAmount As Decimal
    Dim serviceAmount As Decimal

    'Create if/else statements to give variables amounts

    If depositRadio.Checked Then
        depositAmount = amountTextBox.Text
    ElseIf checkRadio.Checked Then
        checkAmount = amountTextBox.Text
    ElseIf serviceChargeRadio.Checked Then
        serviceAmount = amountTextBox.Text
    End If

    'Calculate total

    totalAmount = depositAmount - checkAmount - serviceAmount
    totalTextBox.Text = totalAmount

End Sub
</code></pre>

<p>End Class</p>