How to access resource files

T

Tim Mulholland

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top