473,785 Members | 2,768 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing the CultureInfo

Hi have two subroutines that change the currentCulture
property of my application.

I can call either:

System.Threadin g.Thread.Curren tThread.Current Culture = New
CultureInfo("en-GB")

or:

System.Threadin g.Thread.Curren tThread.Current Culture = New
CultureInfo("es-ES")
In my form load event I call this code:

Label1.Text = Format(500.5, "Currency")

However, I expected the format oif the string in the label to
be updated when the cultureInfo is changed. It does not! Am
I doing anything wrong?

Thanks,

Jason.
Nov 21 '05 #1
5 6926
Jason,

A string is never updated by the culture info

It should update after have set the culture and than do by instance
mylabel = Now.tostring

I hope this helps?

Cor
..
Nov 21 '05 #2
Cor,

am I correct in saying that any changes to the culture info
during the execution of the application will not be reflected
in the formatting of the currency values, etc until the
program is started again?

I was trying the do this with my two buttons on a form, but
when I changed culture info nothing happened unless I
updated the value manually.

Thanks,

Jason

On Thu, 26 Aug 2004 13:17:31 +0200, "Cor Ligthert"
<no**********@p lanet.nl> wrote:
Jason,

A string is never updated by the culture info

It should update after have set the culture and than do by instance
mylabel = Now.tostring

I hope this helps?

Cor
.


Nov 21 '05 #3
Jason,

Try this

I hope this helps?

Cor

\\\Needs a new project a label and a button
Private Sub Form1_Load(ByVa l sender As Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Threading.Threa d.CurrentThread .CurrentCulture = _
New Globalization.C ultureInfo("en-GB")
Label1.Text = Format(500.5, "Currency")
End Sub

Private Sub Button1_Click(B yVal sender As Object, _
ByVal e As System.EventArg s) Handles Button1.Click
If Threading.Threa d.CurrentThread .CurrentCulture .ToString = "es-ES"
Then
Threading.Threa d.CurrentThread .CurrentCulture = _
New Globalization.C ultureInfo("en-GB")
Else
Threading.Threa d.CurrentThread .CurrentCulture = _
New Globalization.C ultureInfo("es-ES")
End If
Me.Label1.Text = Format(500.5, "Currency")
End Sub
///
Nov 21 '05 #4
Cor,

thanks. It looks like I need to manually refresh the textboxes if
the culture info is changed during the execution of my app.

Thanks for the clarification.

Jason.

On Thu, 26 Aug 2004 14:07:45 +0200, "Cor Ligthert"
<no**********@p lanet.nl> wrote:
Jason,

Try this

I hope this helps?

Cor

\\\Needs a new project a label and a button
Private Sub Form1_Load(ByVa l sender As Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Threading.Threa d.CurrentThread .CurrentCulture = _
New Globalization.C ultureInfo("en-GB")
Label1.Text = Format(500.5, "Currency")
End Sub

Private Sub Button1_Click(B yVal sender As Object, _
ByVal e As System.EventArg s) Handles Button1.Click
If Threading.Threa d.CurrentThread .CurrentCulture .ToString = "es-ES"
Then
Threading.Threa d.CurrentThread .CurrentCulture = _
New Globalization.C ultureInfo("en-GB")
Else
Threading.Threa d.CurrentThread .CurrentCulture = _
New Globalization.C ultureInfo("es-ES")
End If
Me.Label1.Text = Format(500.5, "Currency")
End Sub
///


Nov 21 '05 #5
* ja***@no-spam.dive-master.org (Jason L James) scripsit:
Label1.Text = Format(500.5, "Currency")

However, I expected the format oif the string in the label to
be updated when the cultureInfo is changed. It does not! Am
I doing anything wrong?


You will have to reload everything to see it reflecting the new culture
settings.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
357
by: Gani Pola | last post by:
Can someone please tell me how I can change the date format (e.g dd/mm/yyyy, mm/dd/yyyy) in a configuration file? In my windows app, I can retrieve the windows setting but not my ASP.NET application. TIA GP
2
6323
by: choyk1 | last post by:
Hi all, I cannot serialize CultureInfo property as below. It invokes InvalidOperationException. public class One { private CultureInfo culture;
2
9754
by: Alvaro E. Gonzalez V. | last post by:
Hello everybody; Somebody has a simple example of like applying to the change of Globalization to an application MDI with children windows already opened? HEY!!: That "located" properties of my controls automatically change when changing the current culture. Thanks
4
1452
by: Boonaap | last post by:
Hi, I have this asp.net application in which the user can choose between three possible languages. NL - FR - EN How can I set the System.Globalization.CultureInfo to three different values, just by clicking a button? in a pageLoad i have something like this: switch(vLang){
2
1769
by: ziad dodin | last post by:
in an application where a feild (for example Name or item description)is to be entered in both ENGLISH and the Local language say ARABIC: the two input locales are installed on my computer; changing from one input locale to the other is done manually by pressing ALT + SHIFT? this sequence can not be sent using the SEND KEYS method ! I tried ?? how can I do that programatically on a GET FOCUS event??
3
2258
by: Gürkan Demirci | last post by:
Hi, i am trying to write Jananese characters with DrawString(). It is not working. The characters a printed as boxes only. How can i change the culture of my windows forms application ? It seems not to work, because an additional textbox isn't printing in japanese charaters, too. best regards,
4
6295
by: Dirk Behnke | last post by:
How can I start a new process with a different CultureInfo? I have tried already to set the CultureInfo of the thread starting the new process before creating the Process object, but it doesn't help.
2
20202
by: marcussilfver | last post by:
I want to change the culture on a DateTimePicker The code below works somewhat. I get the date in english format when dateTimePicker1 is not expanded. When I click dateTimePicker1 in my application GUI though (and thereby expands dateTimePicker1, showing the dates of the month) at the bottommost I see todays date written in swedish format. Of course I want this to be in english format as well, but how do I do it? thanks.
6
13212
by: =?Utf-8?B?Z3JlZw==?= | last post by:
I've got a windows forms application that uses french and english. We're localizing it right now. It does appear to work if I set the language Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-CA"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-CA"); Just before we run it. How can I setup a button that will toggle the language while the program is running? It seems once it's running, changing the language has no...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10148
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10091
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3646
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.