Thanks in advance
Rounding off decimals in ps.
i want round a money (Float) field from 2.26 to 2.50 and 2.23 to 2.00
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.
VulpesPosted Jul 13, 2012, 4:58 AM
Rajesh KumarPosted Jul 13, 2012, 5:22 AM
Rajesh KumarPosted Jul 13, 2012, 5:00 AM
Thanks for your code,
but it showes out put as 2.3 and i want 2.50
Satyapriya NayakPosted Jul 13, 2012, 4:48 AM
Try
private void Form7_Load(object sender, EventArgs e)
{
float f1 = 2.26f;
float f2 = (float)Math.Round(f1, 1);
MessageBox.Show(f2.ToString());
}
Thanks