Access resources of a .NET DLL from another .NET application?

J

JB

Hi All,

I've got 2 VB.NET applications in which I'd like to use strings
declared in a VB.NET DLL. Is there a way to do that?
Ideally I'd like to access it the same way as I access local resources
i.e. do something like DLL.My.Resources.XXX where XXX is the name of
the resource String.

Thanks
JB
 
R

rowe_newsgroups

Hi All,

I've got 2 VB.NET applications in which I'd like to use strings
declared in a VB.NET DLL. Is there a way to do that?
Ideally I'd like to access it the same way as I access local resources
i.e. do something like DLL.My.Resources.XXX where XXX is the name of
the resource String.

Thanks
JB

I don't think you can access "DLL.My.Resources.XXX" from an outside
assembly - but I don't use the My namespace so I can't be sure.

What I would recommend you to do is to wrap the other Dll's resources
in some public properties. The property would then be responsible for
accessing the My.Resources properties and not an outside assembly.

Thanks,

Seth Rowe
 
J

JB

I don't think you can access "DLL.My.Resources.XXX" from an outside
assembly - but I don't use the My namespace so I can't be sure.

What I would recommend you to do is to wrap the other Dll's resources
in some public properties. The property would then be responsible for
accessing the My.Resources properties and not an outside assembly.

Thanks,

Seth Rowe

Hi Seth,

Thanks for your reply. I could do yes, but that's exactly what's done
in the My namespace so I don't want to duplicate the code (file
Resources.Designer.vb).
The only problem in the My namespace is that all the properties are
declared friend. And since the code is auto generated, I can't change
anything without risking it being overwritten.

Regards
JB
 
H

Herfried K. Wagner [MVP]

JB said:
Thanks for your reply. I could do yes, but that's exactly what's done
in the My namespace so I don't want to duplicate the code (file
Resources.Designer.vb).
The only problem in the My namespace is that all the properties are
declared friend. And since the code is auto generated, I can't change
anything without risking it being overwritten.

You could generate a custom type-safe wrapper for your resources using
"resgen". Check out this tool, it even allows creating a public wrapper.
 
J

JB

You could generate a custom type-safe wrapper for your resources using
"resgen". Check out this tool, it even allows creating a public wrapper.

Thanks I'll have a look at this tool.
 
R

rowe_newsgroups

Hi Seth,

Thanks for your reply. I could do yes, but that's exactly what's done
in the My namespace so I don't want to duplicate the code (file
Resources.Designer.vb).
The only problem in the My namespace is that all the properties are
declared friend. And since the code is auto generated, I can't change
anything without risking it being overwritten.

Regards
JB

Why not copy and paste the auto-generated contents into a new class
file, and do a find and replace to replace the friend declaration with
a public one?

Thanks,

Seth Rowe
 

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