views:

32

answers:

2

I'm having trouble with accessing strongly typed values from my global resource file. VS 2010 is not providing the intellisense, and it is failing while compiling, saying that the type or namespace doesn't exist. Here's my code:

lblGlobalResourceST.Text = System.Resources.GlobalResource.MyName; //MyName is the key/name

My Key/Name pair is : MyName , Matt

Resource File Name: GlobalResource.resx located in root/App_GlobalResources

Framework: 4.0

Language: C#

According to MSDN ,

Resources are compiled into the namespace Resources, and each default resource becomes a member of the Resources class

A: 

One thing I would check is the access modifier value set for the class. You will find it at the top of the resource editor. Make sure it is public.

spinon
For some reason it won't let me edit the Access Modifier via the IDE UI. It's greyed out, and is currently showing nothing. It was at one time showing 'internal'.
contactmatt
I would say try just opening the designer.cs file and you can then change the class access modifier in that file. But make sure you aren't trying to change in debug mode as you won't be able to then.
spinon
+1  A: 

I had to have a

using Resources;

statement at the top of the code.

contactmatt