How to access keys and values of an embedded .resources file???

B

Bob Rock

Hello,

I'd like to programmatically access keys and values of on .resources file
embedded in my assembly.
I've seen that the assembly class provides the GetManifestResourceStream
method .... but then I don't know I to access single keys and values inside
the same .resources file. I'd like to be able to do something like what is
possible with the ResourceManager class but I haven't found a way to use it
with embedded resources but only with external resource files.


Bob Rock
 
B

Bob Rock

William Ryan eMVP said:

I've looked at both articles. The second contains nothing useful. The first
does not show what I asked for.
Suppose I have a SINGLE embedded .resources file in my assembly containing
MANY key/value pairs. I'd like to be able to access the different values
passing in the key. How can I accomplish this???

Bob Rock
 
E

Ernest Morariu

dim resourceName as string
resourceName="<YourNameSpace>.<ResourceName>" ' resource name must be
without extension
' sample: resourceName="Emergency.myResource"

Dim resources As New ResourceManager(resourceName,
[Assembly].GetExecutingAssembly()))

Dim searchedKey as String
Dim FoundValue as String
searchedKey ="?????"
FoundValue = CType(resources.GetObject(searchedKey ), String)

Ernest
 
B

Bob Rock

Ernest Morariu said:
dim resourceName as string
resourceName="<YourNameSpace>.<ResourceName>" ' resource name must be
without extension
' sample: resourceName="Emergency.myResource"

Dim resources As New ResourceManager(resourceName,
[Assembly].GetExecutingAssembly()))

Dim searchedKey as String
Dim FoundValue as String
searchedKey ="?????"
FoundValue = CType(resources.GetObject(searchedKey ), String)

Ernest

Ernest,

I did not know that you could use the ResourceManager class to access
embedded resource files ... I have always used it to access external
..resources and .resx files. Thx.

Bob Rock
 

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