Esempio n. 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                Record r = new Record(rList.getRecordCount(), txtItem.Text, Convert.ToDecimal(txtPrice.Text), dateTimePicker1.Value);
                if (r.getCost() > 100)
                {
                    MessageBox.Show("That is quite a large amount of money. You should try to budget more.");
                }
                rList.add(r);
            }
            catch
            {
                MessageBox.Show("Enter a valid price.");
            }

            dateTimePicker1.Value = DateTime.Now;
            rList.incrementRecordCount();
            txtTotal.Text   = rList.total().ToString();
            txtAverage.Text = rList.average().ToString();
        }