title: Simple Banking Application in Visual Basic
body: <p>I hope that someone can point me in the right direction, as I am new to programming.</p>
  
  <p>I made a basic banking application. It displays a balance for the account, has a textbox for the user to enter the amount, and 2 buttons: one for depositing an amount into the account and one for withdrawing an amount. If the user tries to deposit or withdraw a negative number or "0" then it gives an error that it isn't a valid amount. If the user tries to withdraw more than is in the account, it gives an error that they cannot withdraw more money than is in the account. </p>
  
  <p>My problem is that all the error messages are working for the deposit button, but not for the withdraw button. I used nested If structure, output to a label at the bottom. </p>
  
  <p>I tried using breakpoints to examine my variables, but didn't find any issues. </p>
  
  <p>I don't really want the answer, just some help to understand why the Deposit button will give the error but the Withdraw button won't show either error. </p>
  
  <pre><code>Public Class Form1
      ' Prologue
      ' This is a simple banking application. 
      ' It displays a balance for the account, calculates deposits and withdraws, and gives errors for invalid amounts and overdraws
  
      ' Modular Declarations
      Dim mdecBalance As Decimal = 1000
  
      Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
          ' Output
          lblBalance.Text = mdecBalance.ToString("c")
      End Sub
  
      Private Sub btnDeposit_Click(sender As Object, e As EventArgs) Handles btnDeposit.Click
          ' Declarations
          Dim decDeposit As Decimal
          Dim strDepProblem As String
  
          ' Input
          decDeposit = txtAmount.Text
  
          ' Processing
          If decDeposit &gt; 0 Then
              mdecBalance = mdecBalance + decDeposit
          Else
              If decDeposit &lt;= 0 Then
                  strDepProblem = "That is not a valid amount to deposit"
              End If
          End If
  
          ' Output
          lblBalance.Text = mdecBalance.ToString("c")
          lblMessage.Text = strDepProblem
  
      End Sub
  
      Private Sub btnWithdraw_Click(sender As Object, e As EventArgs) Handles btnWithdraw.Click
          ' Declarations
          Dim decWithdraw As Decimal
          Dim strWithdrawNegative As String
          Dim strWithdrawMoreThan As String
  
          ' Input
          decWithdraw = txtAmount.Text
  
          ' Processing
          If decWithdraw &gt; 0 Then
              mdecBalance = mdecBalance - decWithdraw
          Else
              If decWithdraw &lt;= 0 Then
                  strWithdrawNegative = "Cannot use 0 or negative numbers"
              Else
                  If decWithdraw &gt; mdecBalance Then
                      strWithdrawMoreThan = "Cannot withdraw more than you have"
                  End If
              End If
          End If
  
          ' Output
          lblBalance.Text = mdecBalance.ToString("c")
          lblMessage.Text = strWithdrawNegative
          lblMessage.Text = strWithdrawMoreThan
      End Sub
  End Class
  </code></pre>