Hey guys, well I have figured out how to get the value from a radio button. but what I need to do now is add up all the selected amounts, so for example, chooses 1, then chooses 4. So the total will be 5, but then he chooses 3, so total is now 8.
This is the code I have to get the selected value:
int valueinfo101 = 0;
int count_int101 = 0;
if (radioButton1.Checked)
{
valueinfo101 = 1;
}
else if (radioButton2.Checked)
{
valueinfo101 = 2;
}
else if (radioButton3.Checked)
{
valueinfo101 = 3;
}
else if (radioButton4.Checked)
{
valueinfo101 = 4;
};
And then to show what they selected I wrote this:
textBox1.Text = valueinfo101.ToString();
And then I want to icrease count_int101 so I wrote this:
count_int101++;
So what I want to be able to do now, is have a clear button, and choose again, but have it so that the choosen value adds onto the last one, so the first person chooses 3, clears the selected values, and the second person chooses 2, so the new totals 5. How do I get the total?