Hello all,
I am a Programming student and am having trouble with my first C# windows forms (Could do it in VB). If I am breaking any forum rules by asking for help I am sorry and please delete.
The code I am having trouble with is:
It is supposed to add the values of the selected radio button (radOne = 1000, radTwo = 2000, radThree = 3000) and the check box (chkCherry = 100, chkNuts = 200, chkFudge = 300) and show that sum in lblCalCount. It is not adding properly and most of the time the label stays at 0. I am not asking for someone to fix it for me, but if you could point me in the right direction, that would be great. Thank you.
I am a Programming student and am having trouble with my first C# windows forms (Could do it in VB). If I am breaking any forum rules by asking for help I am sorry and please delete.
The code I am having trouble with is:
int OneScoop; int TwoScoop; int ThreeScoop; int Cherry; int Nuts; int Fudge; int ToppingsSum; int ScoopSum; public void grpNumberofScoops_Enter(object sender, EventArgs e) { if (radOne.Checked == true) OneScoop = 1000; else OneScoop = 0; if (radOne.Checked == true) lblCalCount.Visible = true; else lblCalCount.Visible = false; if (radTwo.Checked == true) TwoScoop = 2000; else TwoScoop = 0; if (radTwo.Checked == true) lblCalCount.Visible = true; else lblCalCount.Visible = false; if (radThree.Checked == true) ThreeScoop = 3000; else ThreeScoop = 0; if (radThree.Checked == true) lblCalCount.Visible = true; else lblCalCount.Visible = false; ScoopSum = OneScoop + TwoScoop + ThreeScoop; } public void grpToppings_Enter(object sender, EventArgs e) { if (chkCherry.Checked == true) Cherry = 100; else Cherry = 0; if (chkNuts.Checked == true) Nuts = 200; else Nuts = 0; if (chkFudge.Checked == true) Fudge = 300; else Fudge = 0; ToppingsSum = Cherry + Nuts + Fudge; } public void lblCalCount_Click(object sender, EventArgs e) { int Sum = ToppingsSum + ScoopSum; if (Sum >= 2500) lblCalCount.ForeColor = Color.Red; lblCalCount.Text = Convert.ToString(Sum); }
It is supposed to add the values of the selected radio button (radOne = 1000, radTwo = 2000, radThree = 3000) and the check box (chkCherry = 100, chkNuts = 200, chkFudge = 300) and show that sum in lblCalCount. It is not adding properly and most of the time the label stays at 0. I am not asking for someone to fix it for me, but if you could point me in the right direction, that would be great. Thank you.
Last edited by a moderator: