jeudi 16 mai 2019

Adding multiple checkbox prices together in VS

Im trying to make it so a user can select one or multiple extra costs and then it adds into one total. But for some reason when the user selects more than one checkbox it only says the price of one of the selected check boxes.

if (CheckBXAccess.Checked)
{
extracost = 1;
extracost += 1;
}
else if (CheckBXTrainer.Checked)
{
extracost = 20;
extracost += 20;
}
else if (CheckBXDiet.Checked)
{
extracost = 20;
extracost += 20;
}
else if (CheckBXVideo.Checked)
{
extracost = 20;
extracost = +20;
}
else return;
Extrachargetxtbx.Text = extracost.ToString();

I want the end result to have the extra charge txt bx display the overall cost of whatever chosen text boxes they have selected.




Aucun commentaire:

Enregistrer un commentaire