title: Banking Application - Calling from a class to a windows form in c#
body: <p>Im learning Windows Forms in c# and finding it difficult to understand working with forms and classes. I am creating a banking application and want the user to be able to:
  press a button and see their current balance,
  enter an amount to debit(take money out) their account, get a success note, or a warning note if they dont have sufficient funds and the balance to update.</p>
  
  <p>I dont understand how to connect the account class to the form and designated, labels and buttons. I have just been trying different things first the past few hours but getting nowhere. Could someone explain how I would show in a label box that there is a balance of 500 when a button is pressed. Also how I could debit the account by entering an amount in a text box and pressing a button. And for a note to be wrote to a label confirming the debit. I have the 'insufficient funds' message in my class but ideally I would like to have that in the form because I have heard that its better practice that way.</p>
  
  <p>I hope I have been clear enough, but will confirm anything! I have asked for a lot of help here as I am new to windows forms, but any help or guidance at all would be appreciated!</p>
  
  <pre><code>class AccountClass
   {
  
      private decimal balance = 500;
  
  
      public AccountClass(decimal myBalance)
      {
          Balance = myBalance;
  
      }
  
      public virtual bool Debit(decimal amount)
      {
          if (amount &gt; Balance)
          {
              Console.WriteLine("There is not enough money in your account");
              return false;
          }
          else
          {
              Balance = Balance - amount;
              return true;
          }
      }
  </code></pre>
  
  <p>Form:</p>
  
  <pre><code>    //button to see balance
      private void btnAccountSeeBalance_Click(object sender, EventArgs e)
      {
          //label balance should print to
          lblAccountBalance.Text = myBalance.ToString();
      }
  
      //button to debit account
      private void btnAccountDebit_Click(object sender, EventArgs e)
      {
          //text box to enter amount to debit
          txtAccountDebitAmount
  
         //label to print confirm/insufficient funds to
         lblAccountDebitSuccess
      }
  </code></pre>