Link to home
Start Free TrialLog in
Avatar of nightshadz
nightshadzFlag for United States of America

asked on

VB .NET Access .resx values

How do I access string values in the Resources (.resx) file ?
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nightshadz

ASKER

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
Have you added a resource file and strings?
Yes.

My file is Resources.resx
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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?
If you only need to store strings then Settings is very useful indeed.