locked
Thousand Format Problem with MSCHART RRS feed

  • Question

  • MSCharts is displaying a period (.) instead of a comma as a thousands separator on my y-axis despite my culture settings in web.config being set to "en-GB". How can I fix/debug this? Pls this is urgent
    Saturday, March 27, 2010 8:05 AM

Answers

  • Hi McSONSY,

    Please check what has beent set for Decimal Symboy in the Regional Settings on your computer.

    To check this, Goto Control Panel->Date, Time, Language, and Regional Options->Customize->Numbers.

    Check for the value of Decimal Symbol. It should be ",".

    http://support.microsoft.com/kb/307938

     

     

    Monday, March 29, 2010 3:58 PM
  • So you have something like this in the code:

    Chart1.ChartAreas(0).AxisY.LabelStyle.Format = "{0:#,##0}"

    And you have something like this in web.config:

    <globalization culture="en-GB" />

    This should work.

    You can check the culture by putting a breakpoint somewhere in the Page.Load -event for example and checking for Globalization.CultureInfo.CurrentCulture.Name and Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator for the separator.

    Setting Me.Culture = "en-GB" in the code should change the culture if for some reason the web.config isn't doing it.

    Also, check that the system you are running the server on, has proper regional settings (if it is en-GB). From the control panel > Region and Language > Additional settings > Digit grouping symbol.

    Monday, March 29, 2010 10:42 AM
    Moderator

All replies

  • Try something like this.

    chrPairings1.ChartAreas[0].AxisY.LabelStyle.Format = "#,####";

    Saturday, March 27, 2010 8:19 AM
  • Its not working.

     I'm still getting 600.000 for 600000 instead of 600,000.

     

    Presently i'm using {0:#,##0}.

     

    Pls i need to solve this urgently.

    Thank you

    Saturday, March 27, 2010 8:33 AM
  • On the form load, you can set the thousand separator for the number format used in the  culture of the current thread. Use the following code.

     

     private void Form1_Load(object sender, EventArgs e)
            {
                    CultureInfo cultureInfo = new CultureInfo("en-GB", false);
                    Thread.CurrentThread.CurrentCulture = cultureInfo;
                    cultureInfo.NumberFormat.NumberGroupSeparator = ",";
                  }  

    Saturday, March 27, 2010 9:02 AM
  • No luck using that.
    Saturday, March 27, 2010 1:01 PM
  • No luck using that.
    Saturday, March 27, 2010 1:01 PM
  • Pls can someone help me with this problem? Its still there!!!
    Monday, March 29, 2010 9:59 AM
  • So you have something like this in the code:

    Chart1.ChartAreas(0).AxisY.LabelStyle.Format = "{0:#,##0}"

    And you have something like this in web.config:

    <globalization culture="en-GB" />

    This should work.

    You can check the culture by putting a breakpoint somewhere in the Page.Load -event for example and checking for Globalization.CultureInfo.CurrentCulture.Name and Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator for the separator.

    Setting Me.Culture = "en-GB" in the code should change the culture if for some reason the web.config isn't doing it.

    Also, check that the system you are running the server on, has proper regional settings (if it is en-GB). From the control panel > Region and Language > Additional settings > Digit grouping symbol.

    Monday, March 29, 2010 10:42 AM
    Moderator
  • Hi McSONSY,

    Please check what has beent set for Decimal Symboy in the Regional Settings on your computer.

    To check this, Goto Control Panel->Date, Time, Language, and Regional Options->Customize->Numbers.

    Check for the value of Decimal Symbol. It should be ",".

    http://support.microsoft.com/kb/307938

     

     

    Monday, March 29, 2010 3:58 PM