C# code to format amount value
Here I have data in a dataset like below
Em开发者_C百科pID Amount
100 890
200 4567.78
300 4578
Now I want C# code to format Amount column values like below
EmpID Amount
100 0890.00
200 4567.78
300 4578.00
Thanks
Anuradha.J
int amount = ????; // vale of the amount column
String.Format("{0:0000.00}", amount);
ok: this is it:
ToString("000000.00")
You can use .ToString(format) (if is a decimal or something like this).
More information here: http://msdn.microsoft.com/en-us/library/fzeeb5cd.aspx
精彩评论