By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,905 Members | 1,585 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,905 IT Pros & Developers. It's quick & easy.

Adding/reading additional attributes to/from Resource files .resx

P: n/a

I'm working with .resx files for a multilanguage application and so far it
has worked
perfectly. However, now I want to add more attributes to the xml schema and
them at running time. ie: I want to programatically generate forms and
their input fields according to the data stored on a resource file. Here is an

NUM_ATTRS: value="4"
ATTR_1: value="Name", required="yes"
ATTR_2: value="Description", required="no"
ATTR_3: value="Price", required="yes"
ATTR_4: value="Reference", required="yes"

If you see, I need an extra attribute called "required". I modified the xml
source of
my resource file and add the following line to the "data" section:

<xsd:attribute name="required" type="xsd:string" />

Now, I see the extra column when editing the resx file on visual studio .net
can set a value to it, but I don't know how to read it. I saw the
documentation of
ResourceManager and there are only two methods to get data from the resource
file: GetString and GetObject; however, they only get the value attribute
and if the
object is an image, then it gets the bitmap itself. I also looked for a
solution in
google, but most of the messages I found doesn't give a solution.

The only way I found was to add an extra string called "ATTR_REQUIRED_n",
where n is a number, and set it to "yes" or "no", but I thing the xml
attributes look
cleaner and more natural. Is possible to do solve this problem with custom xml
attributes? How? Is there perhaps another approach?

Thanks in advanced,
Nov 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.