I am trying to access value in a resource file using a variable in the Name. For example, I can use Resources.Database.MyMessage, but not (of course) string myMessage = "MyMessage" ... "Resources.Database." + myMessage
I'm using a web site and not web project and ResourceManager seems to want an assembly.
Nub
Member
58 Points
60 Posts
Access Resource File with Variable
Nov 19, 2012 06:55 PM|LINK
I am trying to access value in a resource file using a variable in the Name. For example, I can use Resources.Database.MyMessage, but not (of course) string myMessage = "MyMessage" ... "Resources.Database." + myMessage
I'm using a web site and not web project and ResourceManager seems to want an assembly.
This is a cross-post from:
http://social.msdn.microsoft.com/Forums/eu/csharpgeneral/thread/c8969f8d-2d32-4a6f-ba62-cba4cb926994
(Sorry) but I think this is where I should have posted.
Nub
Member
58 Points
60 Posts
Re: Access Resource File with Variable
Nov 19, 2012 07:05 PM|LINK
Answered in other forum by Alan Macgowan.
string message = (String)GetGlobalResourceObject("Database", variableName);
Again, sorry for the cross post.