Noob Concern: Assigning a value to variable from new class object. C#
<pre><code>DinnerFun dinnerFun = new DinnerFun { PeepQty = (int)nudPeepQty.Value };
</code></pre>

<p>I am creating a new object of the DinnerFun class and trying to assign the value from the numeric up down object from the form to the int variable PeepQty.  </p>

<p>When I go into debug mode, I can see that sure enough nudPeepQty has a numeric value, but it is never assigned to PeepQty, and my ending calculation always ends as 0.  </p>

<p>As the problem might be something related to something I've done outside this line of code, I will add the rest of my project below:  </p>

<h2>DinnerParty.cs</h2>

<pre><code>    using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MonuEventPlanning
{
    class DinnerFun
    {
        const int FoodCost = 25;
        public int PeepQty;
        decimal CostOfBeverage;
        decimal CostOfDecorations;
        decimal TotalCost; 

        public void CalcDrinks(bool HealthOption)
        {
            if (HealthOption)
            {
                CostOfBeverage = 5M;
            }
            else
            {
                CostOfBeverage = 20M;
            }
        }

        public void CalcDecorations(bool FancyOption)
        {
            if (FancyOption)
            {
                CostOfDecorations = (PeepQty * 15M) + 50M; 
            }
            else
            {
                CostOfDecorations = (PeepQty * 7.5M) + 30M; 
            }
        }

        public decimal CalcTotalCost(bool HealthyOption)
        {
            if (HealthyOption)
            {
                TotalCost = (CostOfDecorations + CostOfBeverage) * .95M;
                return TotalCost; 
            }
            else
            {
                TotalCost = (CostOfBeverage + CostOfDecorations) + (PeepQty*25M);
                return TotalCost; 
            }
        }
    }
}
</code></pre>

<p>------------Form1.cs -------------</p>

<pre><code>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MonuEventPlanning
{
    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();
        }

        private void btnCalc_Click(object sender, EventArgs e)
        {
            DinnerFun dinnerFun = new DinnerFun { PeepQty = (int)nudPeepQty.Value };
            dinnerFun.CalcDrinks(cbxHealthy.Checked);
            dinnerFun.CalcDrinks(cbxFancy.Checked);
            DisplayCost(); 
        }

        public void DisplayCost()
        {
            DinnerFun dinnerFun = new DinnerFun(); 
            tbxDisplayCost.Text = dinnerFun.CalcTotalCost(cbxHealthy.Checked).ToString("c"); 
        }
    }
}
</code></pre>
