C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Operating System »

c# code to format system culture information


Posted Date: 14 Nov 2008    Resource Type: Code Snippets    Category: Operating System
Author: Anand_lvMember Level: Silver    
Rating: 1 out of 5Points: 7



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;
}



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
C# code.  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: C# Code for Lock Computer
Previous Resource: Shutting Down , Restarting or Logging Off Computer in a Simple Way
Return to Discussion Resource Index
Post New Resource
Category: Operating System


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use