We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

My.Application.ChangeCulture Method

Visual Studio 2008

Changes the culture used by the current thread for string manipulation and for string formatting.

' Usage
' Declaration
Public Sub ChangeCulture( _
   ByVal cultureName As String _


String. Name of the culture as a string. For a list of possible names, see CultureInfo.

The following conditions can cause an exception:

The My.Application.ChangeCulture method changes the current thread's CurrentCulture property. CurrentCulture determines the default formats for dates, times, currency, numbers, sorting order of text, string comparisons, and casing for all computations on that thread.

To retrieve the current culture, you can use the My.Application.Culture Property or the CurrentCulture property.

The CurrentCulture setting is different from a language setting. It contains only data related to the standard settings for a geographical region. Therefore, the CurrentCulture property can only be set to a specific culture or to the InvariantCulture.

Use the My.Application.ChangeUICulture method to change the culture that the current thread uses for retrieving culture-specific resources.

Security noteSecurity Note:

The My.Application.ChangeCulture method requires a SecurityPermission with the ControlThread set. Manipulating threads is dangerous because of the security state associated with threads. Therefore, this permission should be given only as necessary to trustworthy code. You cannot change a thread's culture in semi-trusted code.

This example demonstrates how changing the culture changes the string representation of dates.

Private Sub TestChangeCulture()
    ' Store the current culture. 
    Dim currentculture As String = My.Application.Culture.Name
    MsgBox("Current culture is " & currentculture)

    Dim jan1 As New Date(2005, 1, 1, 15, 15, 15)

    MsgBox("Date represented in en-US culture: " & jan1)
    ' 1/1/2005 3:15:15 PM

    MsgBox("Date represented in invariant culture" & jan1)
    ' 01/01/2005 15:15:15 

    ' Restore the culture.
End Sub

Namespace: Microsoft.VisualBasic.ApplicationServices

Class: WindowsFormsApplicationBase, ApplicationBase

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

Availability by Project Type

Project type


Windows Application


Class Library


Console Application


Windows Control Library


Web Control Library


Windows Service


Web Site


The following permission may be necessary:




Describes a set of security permissions applied to code. Associated enumeration: ControlThread.

For more information, see Code Access Security and Requesting Permissions.