Net-informations.com
SiteMap  | About    

How to CultureInfo in VB.NET

The CultureInfo class specifies a unique name for each culture, based on RFC 4646. The name is a combination of an ISO 639 two-letter lowercase culture code associated with a language and an ISO 3166 two-letter uppercase subculture code associated with a country or region.

  E.g.
  CULTURE - en-CA

ENGLISH NAME - English (Canada)

The user might choose to override some of the values associated with the current culture of Windows through the regional and language options portion of Control Panel. For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture. In general, your applications should honor these user overrides.

The culture is a property of the executing thread. This read-only property returns Thread.CurrentCulture. You can find the current culture information from

  Thread.CurrentThread.CurrentCulture.Name

The following VB.Net program shows how to get all culture names in the .NET Framework. To use CultureInfo class you need to import System.Globalization namespace in your project.




Imports System.Threading
Imports System.Globalization

Public Class Form1

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		'MessageBox.Show(Thread.CurrentThread.CurrentCulture.Name)

		For Each ci As CultureInfo In CultureInfo.GetCultures(CultureTypes.AllCultures)
			MsgBox(ci.EnglishName + " - " + ci.Name)
		Next
	End Sub
End Class




net-informations.com (C) 2016    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.