title: Why are my totals not happening in this little calculator?
body: <p>Starting with this simple little c# windows form tip calculator.  I made a VB version years ago which worked great and I ported to my Palm Treo and was handy back before apps were a thing in the mobile world.  </p>
  
  <p>So, for this Tip Calc, I have a basic windows form with 3 textbox fields: <code>Bill amount</code>, <code>Tip amount (%)</code> and <code>number of people</code>.</p>
  
  <p>I have two labels: <code>label 1</code> to display tip total, <code>label 2</code> display grand total after dividing among party, etc.</p>
  
  <p>I have been banging my head on getting the tip total label to populate during my free time the past 4 days and I just cant get past this hurdle.</p>
  
  <p>I have a <code>calculate</code> button that, when clicked, will create variables, convert textbox data to decimal, (field validation to come later), add bill amount plus tip divided by total in party.  </p>
  
  <p>I ran debug on it and I can see the 'tree' variable populate with the desired total, but for whatever reason, <code>label7</code> will not populate with that total.  </p>
  
  <p>Here is my code:</p>
  
  <pre><code>public partial class Form1 : Form
  {
      private void button1_Click(object sender, EventArgs e)
      {
          decimal check = Convert.ToDecimal(Check.Text);
          decimal tip = Convert.ToDecimal(textBox2.Text);
          decimal ppl = Convert.ToDecimal(textBox3.Text);
          decimal tree = Convert.ToDecimal(tip * check);
          //    tree = Convert.ToDecimal(tip * check);
          if (Decimal.TryParse(label7.Text, out tree))
              MessageBox.Show(tree.ToString());
          //    else
          //       MessageBox.Show(Ex);
          //tree = Decimal.Parse(label7.Text);
          //try { tree = Decimal.Parse(label7.Text); }
          // catch (Exception ex) { System.Windows.Forms.MessageBox.Show("There is some sort of error!"); }
          //label7.Visible = true;
          label8.Text = check + label7.Text;
          label8.Visible = true;
      }
  
      private void Check_KeyPress(object sender, KeyPressEventArgs e)
      {
          char check = e.KeyChar;
  
      }
  }
  </code></pre>
  
  <p><strong>Update:</strong> My formatting was awful indeed.  (Thanks Matti Virkkunen). I have since cleaned up.</p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
  {
      decimal billamt = Convert.ToDecimal(check.Text);
      decimal tipamt = Convert.ToDecimal(tipAmt.Text);
      decimal people = Convert.ToDecimal(numPpl.Text);
      decimal calcttl = Convert.ToDecimal(tipamt * billamt);
      billWithTipLbl.Text = calcttl;
      billWithTipLbl.Visible = true;
      resultLabel.Text = billamt + billWithTipLbl.Text;
      resultLabel.Visible = true;
  }
  </code></pre>
  
  <p>I should clarify.  My original issue was "cannot convert type decimal to string" error when I did assign billWithTipLbl.Text with the tree variable. 
  Label7 has been replaced with billWithTipLbl.  I did have a BillWithTipLbl.Text=calcttl; (was label7.Text=tree;) defined once before, but kept getting "cannot convert type decimal to string".<br>
  What I misunderstood Decimal.TryParse() to be the way to convert properly so calcttl (was tree) could get shoved into the label text.  </p>
  
  <p>label8.Text(now resultLabel.Text) at the time seemed to have no problem taking decimal, I didn't understand why label7.Text(now billWithTipLbl.Text) was having a hard time with the decimal to string thing.</p>