473,387 Members | 1,590 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

changing Culturinfo on buttonclick

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
Nov 19 '05 #1
4 1436
"but I get errors".....

What is the error?

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Boonaap" <Bo*****@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
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

Nov 19 '05 #2
that the variable 'format' is already known...
which in a switch - case construction seems illogic..

"Curt_C [MVP]" wrote:
"but I get errors".....

What is the error?

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Boonaap" <Bo*****@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
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


Nov 19 '05 #3
is the error happening IN the switch or when you try to use the "format"?
run it through the debugger and see where, specifically, it's bombing. Try
declaring "format" outside the switch, but assigning it within it.

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Boonaap" <Bo*****@discussions.microsoft.com> wrote in message
news:01**********************************@microsof t.com...
that the variable 'format' is already known...
which in a switch - case construction seems illogic..

"Curt_C [MVP]" wrote:
"but I get errors".....

What is the error?

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Boonaap" <Bo*****@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
> 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
>
>


Nov 19 '05 #4
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

"Boonaap" <Bo*****@discussions.microsoft.com> wrote in message
news:01**********************************@microsof t.com...
that the variable 'format' is already known...
which in a switch - case construction seems illogic..

"Curt_C [MVP]" wrote:
"but I get errors".....

What is the error?

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Boonaap" <Bo*****@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
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


Nov 19 '05 #5

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

Similar topics

3
by: Geoff Soper | last post by:
I'm trying to dynamically change the cursor of a couple of maps over an image. Basically the image is in an online photo system where there is a rotate mode. In this mode clicking on the left or...
2
by: Urs Vogel | last post by:
Hi When using XmlDocument, I can create nodes and attributes as I like. What I didn't achieve is changing the Value of a node (created with createElement), it claims that it's the wrong node...
1
by: Paul Reddin | last post by:
Hi, Can anyone tell me if the changing of DB Objects in Stinger has been improved ? e.g Changing optionality, renaming etc..... I spend an awful lot of time changing objects because many...
6
by: Eric | last post by:
I have an array, result. I populate the array and add it to an ArrayList. I then change result and add the new version to the ArrayList. However, when I go to review the ArrayList, all of the...
10
by: Altman | last post by:
I have only done a little programming in C++ so I am still learning but I am having a problem with a variable that is changing on me. I have tried this 2 ways with the same result. I have a...
3
by: John | last post by:
I have an asp.net control which on the first Load of the page has a unique ID something like: _ctl0__ctl1_GroupName__ctl1_ControlName and after the first postback it changes to: ...
4
by: Brian Mitchell | last post by:
How do you fire a toolbar ButtonClick event manually (for a specified button)? I have a toolbar with 4 buttons on it and I want to fire one of the button events when the user clicks a different...
32
by: deko | last post by:
I have a popup form with a textbox that is bound to a memo field. I've been warned about memo fields so I'm wondering if I should use this code. Is there any risk with changing the form's...
18
by: Chris Hills | last post by:
A lesson in Posting How many C.L.C group posters does it take to change a C light bulb? 1 to change the light bulb and to post that the light bulb has been changed 14 to share similar...
1
by: DrJarmin | last post by:
Hello The problem is this: in the criteria for a list box I reference the parent form - and Access KEEPS changing the criteria for one that won't work. Details below: I have a couple of list...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.