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

前端 未结 7 2264
误落风尘
误落风尘 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:27

    For complete custom control, use ... .ToString("#,##0.00") or variations thereof. The . and , will be replaced by culture dependent symbols. In most of europe you'd get 1.234,56.
    Another useful picture is 0.0#.

    To use a pattern depending on the users (or on a selected) culture, use The Numeric ("N") Format Specifier, as in .ToString("N") or "... {0:N}".

提交回复
热议问题