Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 2.0
System.Threading
Thread Class
Thread Properties
 CurrentCulture Property
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
.NET Framework Class Library
Thread.CurrentCulture Property

Gets or sets the culture for the current thread.

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)

Visual Basic (Declaration)
Public Property CurrentCulture As CultureInfo
Visual Basic (Usage)
Dim instance As Thread
Dim value As CultureInfo

value = instance.CurrentCulture

instance.CurrentCulture = value
C#
public CultureInfo CurrentCulture { get; set; }
C++
public:
property CultureInfo^ CurrentCulture {
    CultureInfo^ get ();
    void set (CultureInfo^ value);
}
J#
/** @property */
public CultureInfo get_CurrentCulture ()

/** @property */
public void set_CurrentCulture (CultureInfo value)
JScript
public function get CurrentCulture () : CultureInfo

public function set CurrentCulture (value : CultureInfo)

Property Value

A CultureInfo representing the culture for the current thread.

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 <system.dll>
#using <System.Drawing.dll>
#using <system.windows.forms.dll>

using namespace System;
using namespace System::Threading;
using namespace System::Windows::Forms;
ref 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]
int main()
{
   Application::Run( gcnew UICulture );
}
J#
// 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 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker