开发者

C# code to format amount value

开发者 https://www.devze.com 2023-03-15 10:34 出处:网络
Here I have data in a dataset like below Em开发者_C百科pIDAmount 100890 2004567.78 3004578 Now I want C# code to format Amount column values like below

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

0

精彩评论

暂无评论...
验证码 换一张
取 消