My program cannot determine whether to execute Math.Round
as a decimal
or a double
, but I have no idea how to fix this... Here is my code, though the second to last line is what I am concerned with.
ArrayList topp1 = new ArrayList();
int toppcount = 0;
foreach (Control cb in GroupBoxH1T.Controls)
{
CheckBox cb1 = cb as CheckBox;
if (cb1.Checked == true)
{
toppcount++;
topp1.Add(cb1.Text);
}
}
if (cbhwchoice.Checked == false)
{
ArrayList topp2 = new ArrayList();
foreach (Control cb in GroupBoxH2T.Controls)
{
CheckBox cb1 = cb as CheckBox;
if (cb1.Checked == true)
{
toppcount++;
topp2.Add(cb1.Text);
}
}
toppcount = Math.Round((toppcount/2,MidpointRounding.AwayFromZero);
}