i have textbox1 in that i have this value 2784.56894455
i want to round off the above value to 2785.
please send the code.
Regards,
RAO
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Dec 5, 2012, 7:25 AM
Jignesh TrivediPosted Jul 11, 2012, 8:46 AM
you can also do thing using casting in int.
double dou = 123.333;
int i = Convert.ToInt32(dou); --> return 123 and if dou = 123.55 then return 124
hope this will help.
Satyapriya NayakPosted Jul 11, 2012, 8:02 AM
Alternate way
string text = "2784.56894455";
decimal value;
if (decimal.TryParse(text, out value))
{
value = Math.Round(value);
MessageBox.Show(value.ToString());
}
Thanks
VulpesPosted Jul 11, 2012, 7:20 AM
double value = 2784.56894455;
value = Math.Round(value);