c# code to format system culture information

FIRST SET THE SYSTEM CULTURE AS ANY OTHER BUT USING THIS APPLICATION WE RECEIVE ONLY THE INDIAN CULTURE INFORMATION(WHICH WAS SET IN THE FOLLOWING CODE.....)



private void button1_Click(object sender, EventArgs e)
{

Pr_NewMethod();
MessageBox.Show(DateTime.Now.ToString());
MessageBox.Show(String.Format("{0:C}", 123045.93));

}

private static void Pr_NewMethod()
{
int[] ARR={3,2,2};
System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo("en-US");

System.Globalization.DateTimeFormatInfo dateTimeInfo = new System.Globalization.DateTimeFormatInfo();
System.Globalization.NumberFormatInfo NumberInfo = new System.Globalization.NumberFormatInfo ();


dateTimeInfo.DateSeparator = "/";
dateTimeInfo.LongDatePattern = "dd/MMM/yyyy";
dateTimeInfo.ShortDatePattern = "dd/MM/yyyy";
dateTimeInfo.LongTimePattern = "hh:mm:ss tt";
dateTimeInfo.ShortTimePattern = "hh:mm tt";
NumberInfo.CurrencySymbol = "Rs";
NumberInfo.CurrencyDecimalDigits = 3;
NumberInfo.CurrencyDecimalSeparator = ".";
NumberInfo.CurrencyGroupSizes = ARR;
NumberInfo.CurrencyGroupSeparator = ",";
NumberInfo.PositiveInfinitySymbol = " ";
//dateTimeInfo.SetAllDateTimePatterns = "dd/MM/yyyy,hh:mm:ss tt";
cultureInfo.DateTimeFormat = dateTimeInfo;
cultureInfo.NumberFormat = NumberInfo;


Application.CurrentCulture = cultureInfo;
Thread.CurrentThread.CurrentCulture = cultureInfo;
Thread.CurrentThread.CurrentUICulture = cultureInfo;
}


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: