-1

Using windows form application how to get OS region and language date format.

I want string mark in bold in below image.

enter image description here

  • May I know the reason why down vote? – Tushar Chhabhaiya Mar 19 '14 at 08:00
  • 2
    I haven't dwnted but, may be the reason is your question is broad and there are to many answers possible. for example do you want to get the object of CultureInfo?, want to get date format? as per your question title or you want to get name of regional languages? as per your drawn rectangle. if your actual question is Want to string marked in rectangle then update your question title. –  Mar 19 '14 at 08:30

4 Answers4

1

try this

  System.Threading.Thread.CurrentThread.CurrentCulture.EnglishName

     or

  System.Threading.Thread.CurrentThread.CurrentCulture.DisplayName


  result of above code is "Thai (Thailand)"
Heena Chhatrala
  • 242
  • 1
  • 8
0
using System.Globalization;

CultureInfo culture = CultureInfo.CurrentUICulture; // get the culture of the OS
string cultureName = culture.DisplayName; // get its full name

This gives you the culture which was installed with the OS. There seem to be a couple of other static properties of CultureInfo, such as DefaultThreadCurrentCulture and DefaultThreadCurrentUICulture, which may give you what you're looking for.

See the documentation for CultureInfo: http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo%28v=vs.110%29.aspx

jwg
  • 5,547
  • 3
  • 43
  • 57
0

This gives you the name of the culture that the thread is using.

Console.WriteLine(Thread.CurrentThread.CurrentCulture.Name);
Archlight
  • 2,019
  • 2
  • 21
  • 34
0

This has been already answered: Previous answer

Try this,it will solve your problem:

class Region
{
    public class Stateinfo
    {
        public CultureInfo Result { get; set; }
    }

    static void Main(string[] args)
    {
        Thread.CurrentThread.CurrentCulture.ClearCachedData();
        var thread = new Thread(
            s => ((Stateinfo)s).Result = Thread.CurrentThread.CurrentCulture);
        var stateinfo= new Stateinfo();
        thread.Start(stateinfo);
        thread.Join();
        var culture = stateinfo.Result;

    }
}
Community
  • 1
  • 1
Vishal I P
  • 2,005
  • 4
  • 24
  • 41