Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Thread.CurrentCulture Property

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 Language Filter 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: 

See Also

Thread Class | Thread Members | System.Threading Namespace

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft