-5
我想知道如何能夠將文本框中的值添加到標籤中,而不會在每次添加另一個比薩時將標籤重置爲零。我基本上需要代碼才能顯示如何繼續增加文本框值添加到標籤將文本框中的值添加到標籤
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
非常感謝, –