Hello guys i hope that you can help me in my problem, I'm creating a sceintific application and using decimal in my database and in some cases i have to make it up to 6 digits places and when it displayed in the form it becomes so ugly and i got something
like that 125.000000 and the end user dont like it so is there is any way that i can keep the 6 places and in the display whether in the form or in a grid or in a crystal report if there is nothing after the decimal it becomes 125 and if there is any thing
after the decimal it appears
thnx guys but i dont want to round the numbers i want to display it as i got it from the sheets for example in some cases the quantity looks like this 1.200 and in another row it looks like this 0.154315 so i had to make it decimal(18,6) and as aresult the
first row will look like 1.200000 and that is a big problem so i need to keep it with 6 decimal places and in the display if there is zeroos after the dicemal so it could be skipped and the user can accept it if it looks like 1.2 but not 1.200000
Hitman47
0 Points
5 Posts
Decimal places problem
Jul 02, 2012 10:35 AM|LINK
Hello guys i hope that you can help me in my problem, I'm creating a sceintific application and using decimal in my database and in some cases i have to make it up to 6 digits places and when it displayed in the form it becomes so ugly and i got something like that 125.000000 and the end user dont like it so is there is any way that i can keep the 6 places and in the display whether in the form or in a grid or in a crystal report if there is nothing after the decimal it becomes 125 and if there is any thing after the decimal it appears
plz help me guys
thnx in advance
BoogleC
Contributor
2208 Points
445 Posts
Re: Decimal places problem
Jul 02, 2012 10:39 AM|LINK
Hi,
You can keep the decimal and output the format like so: -
String.Format("{0:0,0.0}", 12345.67); // "12,345.7" String.Format("{0:0,0}", 12345.67); // "12,346"HTH's
BoogleC
Please mark the right solution as the answer. This helps others find what they're looking for.
urenjoy
Star
12109 Points
1818 Posts
Re: Decimal places problem
Jul 02, 2012 10:43 AM|LINK
in c#
String.Format("{0:0,0.##}", 12345.67); // 12,345.67 String.Format("{0:0,0.##}", 12345.6); // 12,345.6 String.Format("{0:0,0.##}", 12345); // 12,345Mudasir.Khan
All-Star
15346 Points
3142 Posts
Re: Decimal places problem
Jul 02, 2012 10:46 AM|LINK
please check this
http://www.csharp-examples.net/string-format-double/
mshoaiblibra
Participant
1637 Points
265 Posts
Re: Decimal places problem
Jul 02, 2012 10:52 AM|LINK
You must be use:
M Shoaib Waheed
MCPD [ASP 4.0]
Hitman47
0 Points
5 Posts
Re: Decimal places problem
Jul 02, 2012 11:04 AM|LINK
thnx guys but i dont want to round the numbers i want to display it as i got it from the sheets for example in some cases the quantity looks like this 1.200 and in another row it looks like this 0.154315 so i had to make it decimal(18,6) and as aresult the first row will look like 1.200000 and that is a big problem so i need to keep it with 6 decimal places and in the display if there is zeroos after the dicemal so it could be skipped and the user can accept it if it looks like 1.2 but not 1.200000
any help plz
mshoaiblibra
Participant
1637 Points
265 Posts
Re: Decimal places problem
Jul 02, 2012 12:17 PM|LINK
Dear Hitman,
I think you didn't try this code.
M Shoaib Waheed
MCPD [ASP 4.0]