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


Set a control's meta:resourcekey property programatically

Posted on 2009-12-24
Medium Priority
Last Modified: 2012-05-08
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.
Question by:penlandt
LVL 10

Accepted Solution

RameshS earned 2000 total points
ID: 26121257
Assume that you have YourResourceFile.resx in your App_GlobalResources folder. You can read a resouce using

Label1.Text = Resources.YourResourceFile.ResourceName.ToString();

Author Closing Comment

ID: 31669872
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.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Screencast - Getting to Know the Pipeline
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question