Click here to Skip to main content
15,914,225 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to serialize a C# class Pin
vamsimohan2119-Apr-07 1:58
vamsimohan2119-Apr-07 1:58 
AnswerRe: How to serialize a C# class Pin
peterchen19-Apr-07 7:24
peterchen19-Apr-07 7:24 
QuestionGetting ListView Header Text Pin
Farhan Ali18-Apr-07 23:50
Farhan Ali18-Apr-07 23:50 
AnswerRe: Getting ListView Header Text Pin
Svetlin Panayotov19-Apr-07 0:00
Svetlin Panayotov19-Apr-07 0:00 
GeneralRe: Getting ListView Header Text Pin
Farhan Ali19-Apr-07 0:04
Farhan Ali19-Apr-07 0:04 
GeneralRe: Getting ListView Header Text Pin
Svetlin Panayotov19-Apr-07 4:45
Svetlin Panayotov19-Apr-07 4:45 
GeneralRe: Getting ListView Header Text Pin
Farhan Ali19-Apr-07 20:35
Farhan Ali19-Apr-07 20:35 
GeneralRe: Error in Webservice while using datatable Pin
sujithkumarsl18-Apr-07 23:44
sujithkumarsl18-Apr-07 23:44 
QuestionImporting of resources data for Visual Studio 2005 Pin
sfk_ers18-Apr-07 23:38
sfk_ers18-Apr-07 23:38 
QuestionDifference please..... Pin
Uday_Smile18-Apr-07 23:36
Uday_Smile18-Apr-07 23:36 
AnswerRe: Difference please..... Pin
jonwalmsley18-Apr-07 23:41
jonwalmsley18-Apr-07 23:41 
QuestionDataTable.Select - Something strange Pin
jonwalmsley18-Apr-07 23:34
jonwalmsley18-Apr-07 23:34 
QuestionFind System idle time Pin
Subrahmanyam K18-Apr-07 23:18
Subrahmanyam K18-Apr-07 23:18 
AnswerRe: Find System idle time Pin
jonwalmsley18-Apr-07 23:43
jonwalmsley18-Apr-07 23:43 
QuestionHow to localize a WinForm at run-time Pin
Mikael Wiberg18-Apr-07 22:42
Mikael Wiberg18-Apr-07 22:42 
I am wondering if it is possible to localize a WinForms application at run-time.

I would like to create an application where the culture is changed according to what the user selects in a ComboBox. If "sv-SE" is selected the application should behave as a Swedish application, and if "en-US" is selected it should behave as a US English application.
The application will also contain a NumericUpDown Control that is showing a number containing 2 decimals. In Swedish this could be rendered as '0,00' and in English as '0.00' (notice the difference of the decimal separator).

If I write either of the following two lines of code in the constructor of the WinForm - before the InitializeComponent call it all works:

Thread.CurrentThread.CurrentCulture = new CultureInfo("sv-SE");<br />
Application.CurrentCulture = new CultureInfo("sv-SE");


This means however that the user cannot make this change at run-time (constructor and before InitializeComponent).

If I put the following code in a SelectedIndexChanged event-handler of the ComboBox where the culture is selected it has no impact on how the NumericUpDown is rendered:

if(myComboBox.SelectedIndex == 0)<br />
{<br />
    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");<br />
    Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("en-US");<br />
    Application.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");<br />
}<br />
else<br />
{<br />
    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("sv-SE");<br />
    Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("sv-SE");<br />
    Application.CurrentCulture = CultureInfo.CreateSpecificCulture("sv-SE");<br />
}


Now my question is: is it possible to change this during run-time, and if so, how?
AnswerRe: How to localize a WinForm at run-time Pin
stancrm18-Apr-07 22:49
stancrm18-Apr-07 22:49 
GeneralRe: How to localize a WinForm at run-time Pin
Mikael Wiberg18-Apr-07 22:59
Mikael Wiberg18-Apr-07 22:59 
GeneralRe: How to localize a WinForm at run-time Pin
stancrm18-Apr-07 23:02
stancrm18-Apr-07 23:02 
GeneralRe: How to localize a WinForm at run-time Pin
Mikael Wiberg18-Apr-07 23:24
Mikael Wiberg18-Apr-07 23:24 
AnswerRe: How to localize a WinForm at run-time Pin
Svetlin Panayotov18-Apr-07 23:07
Svetlin Panayotov18-Apr-07 23:07 
GeneralRe: How to localize a WinForm at run-time Pin
Mikael Wiberg18-Apr-07 23:28
Mikael Wiberg18-Apr-07 23:28 
GeneralRe: How to localize a WinForm at run-time Pin
Svetlin Panayotov18-Apr-07 23:51
Svetlin Panayotov18-Apr-07 23:51 
AnswerRe: How to localize a WinForm at run-time Pin
sfk_ers18-Apr-07 23:26
sfk_ers18-Apr-07 23:26 
GeneralRe: How to localize a WinForm at run-time Pin
Mikael Wiberg18-Apr-07 23:29
Mikael Wiberg18-Apr-07 23:29 
QuestionUsing BitBlt to Draw Image Pin
beatles169218-Apr-07 22:11
beatles169218-Apr-07 22:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.