Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 480
  • Last Modified:

VB .NET Access .resx values

How do I access string values in the Resources (.resx) file ?
0
nightshadz
Asked:
nightshadz
  • 4
  • 3
2 Solutions
 
CodeCruiserCommented:
0
 
CodeCruiserCommented:
0
 
nightshadzAuthor Commented:
Can't get the first one to work.  I've tried

        Dim rm As New ResourceManager("Resources", _
            [Assembly].GetExecutingAssembly())

        Dim str As String = rm.GetString("ADPath")
        Console.WriteLine(str)

And get the error
A first chance exception of type 'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
CodeCruiserCommented:
Have you added a resource file and strings?
0
 
nightshadzAuthor Commented:
Yes.

My file is Resources.resx
0
 
x77Commented:
Try using Namespace before Resources:
  "MyNamespace.Resources"

                    Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("CR.Resources", GetType(Resources).Assembly)
0
 
nightshadzAuthor Commented:
I used the Settings instead.  Much easier to do My.Settings.ADPath.

If I only need to store/access strings, is there a difference between using Settings and Resources?
0
 
CodeCruiserCommented:
If you only need to store strings then Settings is very useful indeed.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now