-1

我使用以下这些代码。当我使用这些代码时,它会显示带有值的 $ 符号。我只想以正确的格式显示价值,没有任何符号。

private void button1_Click_2(object sender, EventArgs e)
{
    System.Threading.Thread.CurrentThread.CurrentCulture =
        new CultureInfo("en-US");
    int money = 12346789;
    TextBox1.Text = money.ToString("C");
}
4

2 回答 2

2

Using the format "C" is the correct way to format currency that will be culture-specific / culture-aware.

It sounds like you're actually trying to use a custom format. You could write a formatter for that, or you can just do this:

TextBox1.Text = money.ToString("#,##0.00");
于 2012-05-02T11:50:43.020 回答
2
TextBox1.Text = String.Format("{0:N2}", money);
于 2012-05-02T11:52:51.830 回答