How to insert a thousand separator (comma) with convert to double

前端 未结 7 2305
误落风尘
误落风尘 2020-12-05 03:43

I am trying to format the contents of a text box:

this.lblSearchResults1.Text =
    Convert.ToDouble(lblSearchResults1.Text).ToString(); 

H

7条回答
  •  误落风尘
    2020-12-05 04:36

    If you take a closer look at Standard Numeric Format Strings you can try one of the following:

    .ToString("n", CultureInfo.GetCultureInfo("en-US"))
    .ToString("n", CultureInfo.GetCultureInfo("de-DE"))
    .ToString("n", CultureInfo.CurrentCulture)
    

提交回复
热议问题