This documentation is archived and is not being maintained.
Thread.CurrentCulture Property
.NET Framework 1.1
Gets or sets the culture for the current thread.
[Visual Basic] Public Property CurrentCulture As CultureInfo [C#] public CultureInfo CurrentCulture {get; set;} [C++] public: __property CultureInfo* get_CurrentCulture(); public: __property void set_CurrentCulture(CultureInfo*); [JScript] public function get CurrentCulture() : CultureInfo; public function set CurrentCulture(CultureInfo);
Property Value
A CultureInfo representing the culture for the current thread.
Example
[Visual Basic, C#, C++] 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.
[Visual Basic] ' Compile with option t:winexe /r:System.dll,System.Windows.Forms.dll. Option Explicit Option Strict Imports System Imports System.Threading Imports System.Windows.Forms Public Class UICulture Inherits Form Sub New() ' 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. End Sub <STAThreadAttribute> Shared Sub Main() Application.Run(New UICulture()) End Sub End Class [C#] // 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()); } } [C++] #using <mscorlib.dll> #using <system.dll> #using <system.windows.forms.dll> using namespace System; using namespace System::Threading; using namespace System::Windows::Forms; __gc class UICulture : public 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] void WinMain() { Application::Run(new UICulture()); }
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
.NET Framework Security:
- SecurityPermission for setting the property. Associated enumeration: SecurityPermissionFlag.ControlThread
See Also
Show: