Gets or sets the current culture used by the Resource Manager to look up culture-specific resources at run time.
Assembly: mscorlib (in mscorlib.dll)
Public Property CurrentUICulture As CultureInfopublic CultureInfo CurrentUICulture { get; set; }public:
property CultureInfo^ CurrentUICulture {
CultureInfo^ get ();
void set (CultureInfo^ value);
}member CurrentUICulture : CultureInfo with get, set
Property Value
Type: System.GlobalizationA CultureInfo representing the current culture.
| Exception | Condition |
|---|---|
| ArgumentNullException | The property is set to |
| ArgumentException | The property is set to a culture name that cannot be used to locate a resource file. Resource filenames must include only letters, numbers, hyphens or underscores. |
The CultureInfo returned by this property can be a neutral culture. Neutral cultures should not be used with formatting methods such as String
Note |
|---|
The CultureInfo |
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 /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
// 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());
}
}
#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 );
}
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note