this probably is very simple. This is an assignment for a class, there seems to be several versions of this floating around, and several versions of an answer but I'm not sure how they work. The assignment is to create two forms. One with a dorm price and meal price and the second form is to display the total price. I want the price to display into a input label on the price form. Except I'm not sure how to get the information from one to the other. Does this require me doing a get/set somewhere within my Calculator form? This is form 1(Calculator) code:
public partial class Calculator : Form
{
Price myPrice = new Price();
decimal dorm = 0;
decimal meal = 0;
public Calculator()
{
InitializeComponent();
}
private void getPriceButton_Click(object sender, EventArgs e)
{
decimal price = 0;
getInput();
price = dorm + meal;
myPrice.ShowDialog();
}
private void getInput()
{
if(allenRadioButton.Checked)
{
dorm = 1500;
}
if(pikeRadioButton.Checked)
{
dorm = 1600;
}
if(farthingRadioButton.Checked)
{
dorm = 1800;
}
if(universityRadioButton.Checked)
{
dorm = 2500;
}
if(sevenRadioButton.Checked)
{
meal = 600;
}
if(fourteenRadioButton.Checked)
{
meal = 1200;
}
if(unlimitedRadioButton.Checked)
{
meal = 1700;
}
}
This is form2 (Price) code:
public partial class Price : Form
{
Calculator myCalulator = new Calculator();
public Price()
{
InitializeComponent();
}
priceLabel.Text = price.myCalculator.TosString("c");
}