limit double at six decimal place in asp.net
-
24-09-2019 - |
Question
i have a double, the decimal place isn't fix (8-?)
i want to fix the decimal place to six (for example: 1,234567).
this is my double:
CStr(score)
i guess it's quiet simple :P
Solution
Try this instead:
score.ToString("0.000000")
OTHER TIPS
You can also Math.Round(3.44, 1) 'Returns 3.4.
After Decimal point Add Zero's like this
Dim tot as String
Dim totAmt as Double
totAmt=10.10
tot=String.Format("{0:00.000}", totAmt)
OutPut: 10.100
After Decimal point Remove Zero's like this
totAmt=10.750
tot=Math.Round(totAmt,2)
Output:10.75
Sloved
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow