How to change the current thread current culture at run time.

M

Manu

I have created a new culture :
Dim objCulture As New CultureInfo("he") //hebrew

When I tried to assign it to the current thread.

Thread.CurrentThread.CurrentCulture = objCulture
Thread.CurrentThread.CurrentUICulture = objCulture


This Caused an exception :
" Culture "he" is a neutral culture. It can not be used in
formatting and parsing and therefore cannot be set as the
thread's current culture. "


what is the problem ?
 
N

Natty Gur

Hi,

The right way to set neutral culture is by using CreateSpecificCulture
static function :

System.Threading.Thread.CurrentThread.CurrentCulture =
System.Globalization.CultureInfo.CreateSpecificCulture("he");

Neutral cultures are cultures that just the language set, without the
location.

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top