cultureinfo

Why can't DateTime.ParseExact() parse "9/1/2009" using "M/d/yyyy"

Hi, I have a string that looks like this: "9/1/2009". I want to convert it to a DateTime object (using C#). This works: DateTime.Parse("9/1/2009", new CultureInfo("en-US")); But I don't understand why this doesn't work: DateTime.ParseExact("9/1/2009", "M/d/yyyy", null); There's no word in the date (like "September"), and I know t...

FolderBrowserDialog change language

I have an application where user can choose between 2 languages. Is to possible to change the FolderBrowserDialog language(Buttons, Browse for folder). Maybe with CultureInfo? Thank you for your help. ...

Change culture when deserializing WCF service

I'm using C# to read data from a Java-webservice. I've created a Service reference in VS2008 to the server, and can call the one method that is there. However, a few of the fields returned are of type Decimal, and as the automatically generated WCF proxy gets XML back it fails with a CommunicationException saying: "Error in deserializi...

UICulture List in Asp.Net

Hi, Where can I find complete UICulture list like en : English en-us etc... ...

How to get culture-specific Full Name using CultureInfo

I am trying to find to evaluate name in format specific for user culture. Full Name= First Name + Last Name Is there any method to so this in CultureInfo class and all it properties? Where can I find such format string for each culture? ...

ToString("0") versus ToString(CultureInfo.InvariantCulture)

I would like to make sure that certain numbers in my application are printed without any separators, groupings etc. no matter what the current environment is. It seems that the following two methods produce the same results (there are possibly more): 123456789.ToString("0"); 123456789.ToString(CultureInfo.InvariantCulture); Are you aw...

How to get language without country from CultureInfo

Does anyone know in ASP.Net how to get the language of the currentculture without it's countryname? I know this invariant culture's don't have this problem, but I don't know how to create them without specifying an explicit language. I want to display the active language and in nl-nl this is Dutch (Netherlands). This is how I set the cu...

C# Connecting to Oracle DB DateTime formatting

Hello, I have a .Net webapp that is connecting to an Oracle backend. I have a base page which every page uses where I set my protected override void OnPreInit(EventArgs e) { System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo("en-CA"); // Creating the DateTime Information specific t...

How to get current regional settings in C#?

Normally you can get it by writing something like CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture; But this way you can only get CultureInfo which was configured at the moment application was launched and will not update if the setting have been changed afterwards. So, how to get CultureInfo currently configured in Co...

get cultureinfo with country code

Hi, I try to get CultureInfo with country code. I'm using hostip.info for getting country code. For example, "http://api.hostip.info/?ip=207.46.197.32&position=true" returns me "US" for country code or http://api.hostip.info/?ip=82.151.131.196&position=true returns "TR". If I could have "en-US", "tr-TR", it's easy, but I can't...

Convert.ToDateTime causes FormatException on afternoon date/time values

We have an application parsing date/time values in the following format: 2009-10-10 09:19:12.124 2009-10-10 12:13:14.852 2009-10-10 13:00:00 2009-10-10 15:23:32.022 One particular server all of the sudden (today) started failing to parse any times 13:00:00 or later. This particular client has five servers and only one has the problem...

Why is Environment.NewLine showing up as square character?

I'm working with a .Net windows application. On my machine, a form displays Environment.NewLine correctly as a new line. However, on a tester's machine, the same Environment.NewLine is being displayed as a square character. On both of our machines, we have our regional settings temporarily set to French, for testing purposes. How do I s...

Globalization in C#

Can somebody explain to me what is the use of globalization in C#? Is it used for conversion purposes? I mean I want to convert any English word into a selected language. So will this globalization or cultureinfo help me? ...

Convert language abbreviation to full name, e.g. en to English?

Hello, quick question, what's the best way to convert language a abbreviation to full name? e.g. en to English? Note, it's not en-US, it's just en, fr, de C# please. ...

Why is my CurrentCulture en-GB and my CurrentUICulture en-US

I have a C# application which has to run on machines with different culture settings. No problem I thought, it will just lookup on start up what the current culture is on the machine, and do everything for me. Well no, it would seam that something is not quite right. I have a Windows XP machine with everything in Regional and Language o...

TextInfo.ToTitleCase doesn't work properly, any better solutions?

I'm trying to make my article title well-formatted, I'm currently using TextInfo.ToTitleCase for formating. It does well on most of jobs, but it's not that perfect. For example: Original String: war and peace Expected Result: War and Peace Actual Result: War And Peace Microsoft also use above as the example, it's obviously a known p...

How to set the culture info in unmanaged C++?

Hello, I got a program written in unmanaged C++, I need to get the cultural info from the system and set that info to the current execution thread in my c++ application. Thanks. ...

How to force a particular .resx file to be used in a WPF DLL?

I have a WPF DLL being called from an unmanaged DLL. The WPF DLL has a dialog that has been translated (two sets of .resx files). If I call the WPF DLL from a WinForm shell, or another WPF shell, I can force the dialog to a particular language (.resx file) by setting the Culture of the current thread. However, when calling the WPF DLL ...

How does one set text of two labels with two different cultural/region format options?

How does one set text of two labels with two different cultural/region format options? For first label to be ar-EG : Arabic - Egypt and second one to be en-US : English - United States ? This to be done for Number/Date/Time/Currency formats. ...

Custom Formating a DateTimePicker using CultureInfo

I am using the DateTimePicker control in a Vb.Net Windows project. I would like the date to reflect the Regional Settings on the user's computer, but also to show the month name, rather than the month number. For example, if my computer is set to English(US), I would like to see Nov 26 2009, and if my computer is set to English (NZ), I...