locked
Number format based on the Culture Info RRS feed

  • Question

  • User1171224296 posted

    Hi,

        I have an Label where I need to show the value 0.00 if the culture is Englidh and 0,00 if the Culture is french. I am using the following code but it does not work. Can anyone help me? If you have also other materials related to this please share it.

     string minAmount = "0.00";

     DisplayLabel.Text = minAmount.ToString(NumberFormatInfo.CurrentInfo);

     

     

    Monday, November 22, 2010 1:43 AM

Answers

  • User1633691049 posted

    Hi,

    The minimum amount should be a number (decimal for example):

    DisplayLabel.Text = ((decimal)0).ToString("n2");

    An IFormatProvider parameter of ToString overload is necessary only when you want to use a different one besides the one provided by the current culture.

    Florin


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 22, 2010 7:38 AM