Home All Groups Group Topic Archive Search About

Errors when translating CultureInfo from C# to VB

Author
16 Apr 2005 8:57 AM
ReidarT
I use cultureinfo to select right language on labels on webform.
In C# it works OK,
but in this project with VB I get some problems.

//*********** The code is: ****************************
....
1. using System.Resources;
2. using System.Globalization;
3. using System.Threading;

4. namespace namespaceName

5. public class Test : Sustem.Web.UI.Page
...
6.  protected ResourceManager rmName;

7. private void Page_Load(....
8. {
9.  string strCultureInfo = "Fr";   //french
10.  Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture(strCultureInfo);
11.  Thread.CurrentThread.CurrentUICulture = new CultureInfo(strultureInfo);
12.  rmName = new ResourceManager("namespaceName.ProjectName",
typeof(webform).Assembly);

13.  lblAddress.Text = rmName.GetString("Address");
14. }

//************** Stop ***************************

In VB I get problems on line 6 and line 12
There must be another syntax i VB
reidarT

Author
16 Apr 2005 10:06 AM
Crouchie1998
It is not the job of this newgroup to convert code from C# to VB.NET. There
are many convertors out there on the Internet.

Line 5 Spelling mistake - should be SYSTEM not SUSTEM

Line 11 Spelling mistake - should be StrCultureInfo not strultureInfo

and so on.

Crouchie1998
BA (HONS) MCP MCSE
Author
16 Apr 2005 11:14 AM
Herfried K. Wagner [MVP]
"ReidarT" <rei***@eivon.no> schrieb:
>I use cultureinfo to select right language on labels on webform.
> In C# it works OK,
> but in this project with VB I get some problems.

Converting code between .NET programming languages
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=languageconverters&lang=en>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
16 Apr 2005 12:20 PM
Cor Ligthert
Reidar,

Are you sure this is working in a ASPNet environment and not taking the
language from the server.

In my opinion can you use the httprequest.servervariables to get the
language from the client

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebHttpRequestClassServerVariablesTopic.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/21b3be8f-d4ed-4059-8e21-6cba2c253006.asp
HTTP_ACCEPT_LANGUAGE

While the culture is missing.

Therefore you make me curious.

Cor