Changing the Current Culture

Your application automatically reads the culture settings of the system and implements them. Thus, in most circumstances, you will not have to manually change the culture settings. You can, however, change the current culture of your application in code by setting the current culture to a new instance of the CultureInfo class. The CultureInfo class contains information about a particular culture and how it interacts with the application and system. For example, the CultureInfo class contains information about the type of calendar, date formatting, currency formatting, and so on for a specific culture. You set the current culture of an application programmatically by setting the CurrentThread.CurrentCulture property to a new instance of the CultureInfo class. The CultureInfo constructor requires a string that represents the appropriate culture code as a parameter. The following code example demonstrates how to set the current culture to French Canadian:

System.Threading.Thread.CurrentThread.CurrentCulture = New _ System.Globalization.Cu1tureInfo("fr-CA")

System.Threading.Thread.CurrentThread.CurrentCulture = new System.Gl obal ization.Cu1tureInfo("fr-CA");

Was this article helpful?

0 0

Post a comment