im extremely new to c# so im having a little difficulty with the following problem.
below is my following code
int access = 1;
int onlineVideos = 2;
int personalTrainer = 20;
int dietConsultation = 20;
int extras = 0;
if (checkBox1.Checked)
{
extras += access;
}
else if (checkBox2.Checked)
{
extras += onlineVideos;
}
else if (checkBox3.Checked)
{
extras += personalTrainer;
}
else if (checkBox4.Checked)
{
extras += dietConsultation;
}
textBox6.Text = extras.ToString();
i want to be able to easily add the sums of all the boxes that are checked, and then print them to a textbox.
Aucun commentaire:
Enregistrer un commentaire