string format for numbers or currency?
I need to give comma(,开发者_StackOverflow社区) for every thousends. So I used DataFormatString="${0:#,#}". It is working fine. But when value is 0. It is showing $00. I just want to show only $0.
How can we do that?
DataFormatString = "{0:C0}"
That will format as a currency with 0 decimal places.
DataFormatString = "{0:N0}"
This will format as a number such as 1,000. If you want decimal places then replace the second 0 with however many numbers you want after the decimal.
For example:
DataFormatString = "{0:N4}"
Would format like 1,000.0000
Format = "${0:#,0}";
加载中,请稍侯......
精彩评论