.NETGURU
Project with cultural problem
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngreg' list.


Anders.Vikstrom@banqit.com
-- Copied from [aspngvs] to [aspngreg] by Charles Carroll <Click here to reveal e-mail address> --Help, something is wrong with our project!We have an ASP.NET VB-project that always formats numbers etc. =according tothe "en-US" culture, no matter what we do. Even the following doesn't =work:System.Threading.Thread.CurrentThread.CurrentCulture =3D=20    New System.Globalization.CultureInfo("sv-SE")System.Threading.Thread.CurrentThread.CurrentUICulture =3DSystem.Threading.Thread.CurrentThread.CurrentCultureTextBox1.Text =3D Now.ToStringIt must be something wrong on project/application level, because if we =takea page that works from another application and includes it in this =projectit stops working.If anybody knows of a setting (or similar) that we might have =forgotten, Iwould greatly appreciate to be informed thereof.___________________________________________________________Anders Vikstr=F6mSW Engineering, BANQIT ABhttp://www.banqit.commailto:Click here to reveal e-mail addresse: +46 8 7594737
Reply to this message...
 
    
Trevor
Anders,

using System.Globalization;

CultureInfo c = new CultureInfo("sv-SE"); // Whatever culture you want the
numbers to format as.
System.Threading.Thread.CurrentThread.CurrentCulture = c;
System.Threading.Thread.CurrentThread.CurrentUICulture = c;

That should work. Although it seems like you did that already. Perhaps
.NET doesn't recognize the culture sv-SE and defaults to american
format. Try de-DE or something and play around with some other
cultures. See if its culture specific.

if it is you can always override the current number format by going
System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.... =
wahtever

ie.
System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern
= "M/dd/yyy";

Hope this kinda helps. i would try to have a code sample but i gotta go to
bed!!!

-Trevor

At 06:18 PM 11/1/2001 +0100, you wrote:
[Original message clipped]

Reply to this message...
 
    
Anders.Vikstrom@banqit.com
Thanks for the tip, Trevor. German (de-DE) did work. In fact, all cultures I
tried worked. All but Swedish (sv-SE). However, I can get Swedish to work
too. How? Buy changing the current locale in the control panel from Swedish
to something else. Weird, huh? Or do you, or anybody else have a sane
explanation for this behavior?<?xml:namespace prefix = o ns "urn:schemas-microsoft-com:office:office" />

Regards,

Anders

-----Original Message-----
From: Trevor [mailto:Click here to reveal e-mail address]
Sent: den 2 november 2001 07:07
To: aspngreg
Subject: [aspngreg] Re: Project with cultural problem

Anders,

using System.Globalization;

CultureInfo c = new CultureInfo("sv-SE"); // Whatever culture you want the
numbers to format as.
System.Threading.Thread.CurrentThread.CurrentCulture = c;
System.Threading.Thread.CurrentThread.CurrentUICulture = c;

That should work. Although it seems like you did that already. Perhaps
.NET doesn't recognize the culture sv-SE and defaults to american format.
Try de-DE or something and play around with some other cultures. See if its
culture specific.

if it is you can always override the current number format by going
System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.... wahtever

ie.
System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDat
ePattern = "M/dd/yyy";

Hope this kinda helps. i would try to have a code sample but i gotta go to
bed!!!

-Trevor

At 06:18 PM 11/1/2001 +0100, you wrote:

-- Copied from [aspngvs] to [aspngreg] by Charles Carroll
<Click here to reveal e-mail address> --

Help, something is wrong with our project!

We have an ASP.NET VB-project that always formats numbers etc. according to
the "en-US" culture, no matter what we do. Even the following doesn't work:

System.Threading.Thread.CurrentThread.CurrentCulture =3D=20
New System.Globalization.CultureInfo("sv-SE")
System.Threading.Thread.CurrentThread.CurrentUICulture =3D
System.Threading.Thread.CurrentThread.CurrentCulture
TextBox1.Text =3D Now.ToString

It must be something wrong on project/application level, because if we take
a page that works from another application and includes it in this project
it stops working.

If anybody knows of a setting (or similar) that we might have forgotten, I
would greatly appreciate to be informed thereof.

___________________________________________________________

Anders Vikstr=F6m
SW Engineering, BANQIT AB
http://www.banqit.com <http://www.banqit.com/" target="_blank">http://www.banqit.com/>
mailto:Click here to reveal e-mail address <mailto:Click here to reveal e-mail address>
Phone: +46 8 7594737

| [aspngreg] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngreg.asp
<http://www.asplists.com/asplists/aspngreg.asp> = JOIN/QUIT
| http://www.asplists.com/search <http://www.asplists.com/search> = SEARCH
Archives

| [aspngreg] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngreg.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives
Reply to this message...
 
    
Trevor
Thanks for the update!

Keep us posted (the 5 or 6 ppl in this entire group) if you are able to
figure out your problem.

At 10:06 AM 11/6/2001 +0100, you wrote:

[Original message clipped]

Reply to this message...
 
 
System.Globalization.CultureInfo
System.Threading.Thread




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification