title: My Accumulator is not working in VB (Visual Studio 2010)
body: <p>My accumulator (decTotalCredits) is not working properly and is resetting to zero with each entry.  I am needing the accumulator to add in each user input until it hits 125. As it normally is, I'm sure it's something small.  Thanks in advance for all your help!</p>
  
  <pre><code>    ' Declaring variable for Credit Entered by User
      Dim decCredit As Decimal = CDec(txtCredit.Text)
      ' Declaring the accumulator
      Dim decTotalCredits As Decimal
  
      If IsNumeric(txtCredit.Text) Then
          decCredit = Convert.ToDecimal(txtCredit.Text)
          Select Case decCredit
              Case Is = 5
              Case Is = 10
              Case Is = 25
              Case Is = 100
              Case Else
                  MsgBox("Please enter a valid coin amount", , "Invalid Amount Entered")
          End Select
  
          If decTotalCredits &lt; 125 Then
  
              decTotalCredits += decCredit
              lblTotal.Text = CStr(decTotalCredits)
              lblTotal.Visible = True
  
              txtCredit.Clear()
              txtCredit.Focus()
  
          Else
  
              ' Once the credits are reached the prompt to make selection is visible. 
              lblMakeSelection.Visible = True
  
              ' Once the credits are reached, the buttons for selection become enabled.
              btnDietPepsi.Enabled = True
              btnPepsi.Enabled = True
              btnSierraMist.Enabled = True
              btnLemonade.Enabled = True
              btnDrPepper.Enabled = True
              btnWater.Enabled = True
          End If
      Else
          MsgBox("Please enter a valid Coin amount", , "Input Error")
  
  
      End If
  </code></pre>