468,306 Members | 1,233 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,306 developers. It's quick & easy.

How to access resource files

I can't find a good solid example on how to access strings from a resource
file.
I know i need to create a ResourceManager object, and then call the
GetString method on it. My problem is that if i try to access anything from
a resource file other than one of the ones connected with a Form, it can
never find it.
So can someone just point me in the right direction with this...

I add an Assembly Resource File called MyStrings.resx to my project.
I then go in and add in a couple lines to the resource file such as

StringA, This is my StringA, null, null, null
StringB, This is my StringB, null, null, null

now, if i want to pull one of these strings from a function in any class in
my assembly, how do i go about doing it?

System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(???);
resources.GetString(???)

Thanks in advance for the clarification!

Tim
Nov 15 '05 #1
1 8767
nevermind, i figured it out.
"Tim Mulholland" <Mu***************@alumni.virginia.edu> wrote in message
news:u5**************@TK2MSFTNGP11.phx.gbl...
I can't find a good solid example on how to access strings from a resource
file.
I know i need to create a ResourceManager object, and then call the
GetString method on it. My problem is that if i try to access anything from a resource file other than one of the ones connected with a Form, it can
never find it.
So can someone just point me in the right direction with this...

I add an Assembly Resource File called MyStrings.resx to my project.
I then go in and add in a couple lines to the resource file such as

StringA, This is my StringA, null, null, null
StringB, This is my StringB, null, null, null

now, if i want to pull one of these strings from a function in any class in my assembly, how do i go about doing it?

System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(???);
resources.GetString(???)

Thanks in advance for the clarification!

Tim

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by ajdfljsdf | last post: by
3 posts views Thread by Marc Nadeau | last post: by
reply views Thread by ASP.Confused | last post: by
1 post views Thread by Steve Franks | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.