Thread.CurrentUICulture Property
Assembly: mscorlib (in mscorlib.dll)
/** @property */ public CultureInfo get_CurrentUICulture () /** @property */ public void set_CurrentUICulture (CultureInfo value)
public function get CurrentUICulture () : CultureInfo public function set CurrentUICulture (value : CultureInfo)
Not applicable.
Property Value
A CultureInfo representing the current culture.The CultureInfo returned by this property can be a neutral culture. Neutral cultures should not be used with formatting methods such as String.Format, DateTime.ToString, and Convert.ToString. Use the System.Globalization.CultureInfo.CreateSpecificCulture(System.String) method to get a specific culture, or use the CurrentCulture property. For more information, see Formatting for Different Cultures.
Note: |
|---|
| The System.Globalization.CultureInfo.CreateSpecificCulture(System.String) method throws ArgumentException for the neutral cultures "zh-Hant" ("zh-CHT") and "zh-Hans" ("zh-CHS"). |
| Topic | Location |
|---|---|
| How to: Set the Culture and UI Culture for ASP.NET Web Page Globalization | Building ASP .NET Web Applications |
| How to: Set the Culture and UI Culture for ASP.NET Web Page Globalization | Building ASP .NET Web Applications |
The following code example shows the threading statement that allows the user interface of a Windows Forms to display in the culture that is set in Control Panel. Additional code is needed.
// Compile with option /t:winexe. using System; using System.Threading; using System.Windows.Forms; class UICulture : Form { public UICulture() { // Set the user interface to display in the // same culture as that set in Control Panel. Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; // Add additional code. } [STAThreadAttribute] static void Main() { Application.Run(new UICulture()); } }
// Compile with option /t:winexe.
import System.*;
import System.Threading.*;
import System.Threading.Thread;
import System.Windows.Forms.*;
class UICulture extends Form
{
public UICulture()
{
// Set the user interface to display in the
// same culture as that set in Control Panel.
Thread.get_CurrentThread().set_CurrentUICulture(
Thread.get_CurrentThread().get_CurrentCulture());
// Add additional code.
} //UICulture
/** @attribute STAThreadAttribute()
*/
public static void main(String[] args)
{
Application.Run(new UICulture());
} //main
} //UICulture
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Note: