For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > January 2005 > Accessing "Resources" from class libraries









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Accessing "Resources" from class libraries
Roger Helliwell

2005-01-29, 8:56 am

Hi gang,

I'm loving the new Resource features in Whitbey. No longer are there
any Button1.Text = "Click Here" lines in my code-behinds. All have
been replaced with Resources.Labels.ClickHere (Our site is in 3
languages).

But, is there a way to access the Resources namespace from another
class library? I've searched all through the HttpContext class for a
mention of it but no luck.

Thanks,
Roger

Daniel Fisher\(lennybacon\)

2005-01-30, 3:57 pm

Have a look @ System.Resources namspace

--
Daniel Fisher(lennybacon)
MCP ASP.NET C#
Blog: http://www.lennybacon.com/


"Roger Helliwell" <rhelliwell@telus.net> wrote in message
news:nfpmv0h6je477ncka0s7486d6qqt8f2vhc@
4ax.com...
> Hi gang,
>
> I'm loving the new Resource features in Whitbey. No longer are there
> any Button1.Text = "Click Here" lines in my code-behinds. All have
> been replaced with Resources.Labels.ClickHere (Our site is in 3
> languages).
>
> But, is there a way to access the Resources namespace from another
> class library? I've searched all through the HttpContext class for a
> mention of it but no luck.
>
> Thanks,
> Roger
>



Roger Helliwell

2005-01-31, 3:59 am

On Sun, 30 Jan 2005 15:50:45 +0100 in
microsoft.public.dotnet.framework.aspnet, "Daniel
Fisher\(lennybacon\)" <info@(removethis)lennybacon.com> wrote:

>Have a look @ System.Resources namspace


Hi Daniel,

Not sure what I'm after in that namespace. I've looked at
ResourceManager and ResourceSet, but so far no luck. Do I need to
physically load the .resx file using reflection or something similar?

Here's what I know so far...

Each .resx file in /Application_GlobalResources is translated to a
static class within the "Resources" namespace. So for example,
"Errors.resx" can be accessed using Resources.Errors.SomeErrorCode.
These classes exist in the web-application code space, so how can an
external class reference them without adding a reference?

Any further thoughts?

Roger

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com