error while round the value?
the following error occured while round the value ("Index was outside the bounds of the array.")
my code behind is..
double present = Convert.ToDouble(upnoodP.Text);
double X = 100;
double totaldays = Convert.ToDouble(uptwd.Text);
double total = (present * X) / totaldays;
string[] str = total.ToString().Split('.');
double no1 = Convert.ToDouble("0." + str[1]);
double result;
if (no1 < 0.51)
{
result = Math.Floor(total);
uppercent.Text = Convert.ToString(result) + "%";
}
else
{
result = Math.Round(total);
uppercent.Text = Convert.ToString(result) + "%";
}
how to resolve this error...