changing Culturinfo on buttonclick

G

Guest

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){
case "NL":
System.IFormatProvider format = new
System.Globalization.CultureInfo("nl-BE", true);
break;
case "FR":
System.IFormatProvider format = new
System.Globalization.CultureInfo("fr-BE", true);
break;
case "EN":
System.IFormatProvider format = new
System.Globalization.CultureInfo("en-Us", true);
break;
}
but I get errors

anyone a Clue ?
thx
 
G

Guest

that the variable 'format' is already known...
which in a switch - case construction seems illogic..
 
E

Eliyahu Goldin

You are defining it in every case. You should do it once before switch and
then just refer to it:

System.IFormatProvider format;
switch(vLang){
case "NL":
format = new
System.Globalization.CultureInfo("nl-BE", true);
break;
case "FR":
format = new
System.Globalization.CultureInfo("fr-BE", true);
break;
case "EN":
format = new
System.Globalization.CultureInfo("en-Us", true);
break;
}

Now, it makes sense to make a radio button list for the language selection
and to check wich option is selected in the switch statement.

Eliyahu
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top