By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,239 Members | 1,505 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,239 IT Pros & Developers. It's quick & easy.

Changing the CultureInfo

P: n/a
Hi have two subroutines that change the currentCulture
property of my application.

I can call either:

System.Threading.Thread.CurrentThread.CurrentCultu re = New
CultureInfo("en-GB")

or:

System.Threading.Thread.CurrentThread.CurrentCultu re = 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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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**********@planet.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

P: n/a
Jason,

Try this

I hope this helps?

Cor

\\\Needs a new project a label and a button
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Threading.Thread.CurrentThread.CurrentCulture = _
New Globalization.CultureInfo("en-GB")
Label1.Text = Format(500.5, "Currency")
End Sub

Private Sub Button1_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Button1.Click
If Threading.Thread.CurrentThread.CurrentCulture.ToSt ring = "es-ES"
Then
Threading.Thread.CurrentThread.CurrentCulture = _
New Globalization.CultureInfo("en-GB")
Else
Threading.Thread.CurrentThread.CurrentCulture = _
New Globalization.CultureInfo("es-ES")
End If
Me.Label1.Text = Format(500.5, "Currency")
End Sub
///
Nov 21 '05 #4

P: n/a
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**********@planet.nl> wrote:
Jason,

Try this

I hope this helps?

Cor

\\\Needs a new project a label and a button
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Threading.Thread.CurrentThread.CurrentCulture = _
New Globalization.CultureInfo("en-GB")
Label1.Text = Format(500.5, "Currency")
End Sub

Private Sub Button1_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Button1.Click
If Threading.Thread.CurrentThread.CurrentCulture.ToSt ring = "es-ES"
Then
Threading.Thread.CurrentThread.CurrentCulture = _
New Globalization.CultureInfo("en-GB")
Else
Threading.Thread.CurrentThread.CurrentCulture = _
New Globalization.CultureInfo("es-ES")
End If
Me.Label1.Text = Format(500.5, "Currency")
End Sub
///


Nov 21 '05 #5

P: n/a
* 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 discussion thread is closed

Replies have been disabled for this discussion.