Я хотел знать, как я могу продолжать добавлять значения из текстового поля в метку, без сброса метки до нуля при каждом добавлении другой пиццы. Мне в основном нужен код, показывающий, как добавить значение текстового поля держать добавить к меткеДобавление значений из текстового поля в метку
private void SummaryBox_TextChanged(object sender, EventArgs e)//Textbox:the value is shown of the pizza selected
{
}
private void txtPizzaPrice_TextChanged(object sender, EventArgs e)
{
}
Menu(object sender, System.ComponentModel.CancelEventArgs e)
{
private void lblPrice_Click(object sender, EventArgs e)
{
// Label where the Pizza prices needs to be added up each time I press add pizza
}
}
}
//HERE ARE THE PIZZA VALUES
double PizzaPrice;//Global
double ExtraTopping;//Global
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
string CT;
if (radioButton2.Enabled == true) //PIZZA CHEESE TOMATO
{
double ctp = 3.50;
PizzaPrice = ctp;
txtPizzaPrice.Text = "£ " + PizzaPrice.ToString(); //Value I want //to add to lblPrice
CT = radioButton2.Text;
SummaryBox.Text = CT;
}
else
{
SummaryBox.Clear();
}
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
string VS;
if (radioButton1.Enabled == true) //PIZZA Veg SUpreme
{
double vsp = 5.20;
PizzaPrice = vsp;
txtPizzaPrice.Text = "£ " + PizzaPrice.ToString(); //Value I want //to add to lblPrice
VS = radioButton1.Text;
SummaryBox.Text = VS;
}
else
{
SummaryBox.Clear();
}
}
private void radioButton3_CheckedChanged_1(object sender, EventArgs e)
{
string SV;
if (radioButton3.Enabled == true) //PIZZA SPicy Veg
{
double svp = 5.20;
PizzaPrice = svp;
txtPizzaPrice.Text = "£ " + PizzaPrice.ToString(); //Value I want //to add to lblPrice
SV = radioButton3.Text;
SummaryBox.Text = SV;
}
else
{
SummaryBox.Clear();
}
}
private void radioButton6_CheckedChanged(object sender, EventArgs e)
{
string MF;
if (radioButton6.Enabled == true) //PIZZA Veg SUpreme
{
double mfp = 5.80;
PizzaPrice = mfp;
txtPizzaPrice.Text = "£ " + PizzaPrice.ToString(); //Value I want //to add to lblPrice
MF = radioButton6.Text;
SummaryBox.Text = MF;
}
else
{
SummaryBox.Clear();
}
}
private void radioButton7_CheckedChanged(object sender, EventArgs e)
{
string HP;
if (radioButton7.Enabled == true) //PIZZA Ham pineapple
{
double hpp = 4.20;
PizzaPrice = hpp;
txtPizzaPrice.Text = "£ " + PizzaPrice.ToString();
^Value I want to add to lblPrice^
HP = radioButton7.Text;
SummaryBox.Text = HP;
}
else
{
SummaryBox.Clear();
}
}
private void radioButton4_CheckedChanged(object sender, EventArgs e)
{
string SF;
if (radioButton4.Enabled == true) // PIZZA Veg SUpreme
{
double sfp = 5.60;
PizzaPrice = sfp;
txtPizzaPrice.Text = "£ " + PizzaPrice.ToString(); //Value I want //to add to lblPrice
SF = radioButton4.Text;
SummaryBox.Text = SF;
}
else
{
SummaryBox.Clear();
}
}
Подсказка, которая может помочь в будущем: ваша срочность (1) ничего особенного и (2) не собирается выигрывать у вас какие-либо очки. Ваш лучший выбор для быстрого ответа - сформулировать очень четкий, хорошо сформулированный, качественный вопрос. – dmckee
В вашем коде есть ошибки копирования. Можете ли вы немного почистить это, сосредоточив внимание на сужении именно там, где у вас проблема? – paqogomez
Спасибо, очень –