Set a control's meta:resourcekey property programatically

Is there a way to set the meta:resourcekey property of a control programatically?  Here's why I'm asking.  I'm developing a multi-language app.  I have a label on my form that will display error message text.  I'd like the message to be informative so I want to create resourcekeys for each anticipated error and then assign the appropriate resourcekey when the error occurs.  Is this possible?  Thanks!

P.S.  By the way, I'm developing in VB so if you have any code examples in VB, that would be appreciated.
LVL 1
penlandtAsked:
Who is Participating?
 
RameshSCommented:
Assume that you have YourResourceFile.resx in your App_GlobalResources folder. You can read a resouce using

Label1.Text = Resources.YourResourceFile.ResourceName.ToString();
0
 
penlandtAuthor Commented:
I can't believe the solution was so simple.  I searched all over and couldn't find anything online about this.  All the examples I could find showed how to access resources through your HTML but nothing about doing it this way.  Thanks for the quick and useful help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.