Custom Currency symbol and decimal places using decimal.ToString(“C”) and CultureInfo

后端 未结 5 1945
长发绾君心
长发绾君心 2021-01-05 05:00

I have a problem with decimal.ToString(\"C\") override. Basically what I wants to do is as follows:

CultureInfo usCulture = new CultureInfo(\"en         


        
5条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-05 05:28

    use this format string :

    #,##0.00 $;#,##0.00'-  $';0 $
    
    decimal paid = Convert.ToDecimal(dr["TotalPaids"]);
    lblPaids.Text = paid.ToString("#,##0.00 $;#,##0.00'-  $';0 $");
    

提交回复
热议问题