468,315 Members | 1,472 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,315 developers. It's quick & easy.

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

Hi,

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
read
them at running time. ie: I want to programatically generate forms and
validate
their input fields according to the data stored on a resource file. Here is an
example:

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
and
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,
Josef
Nov 17 '05 #1
0 1447

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Gabriel Lozano-Morán | last post: by
4 posts views Thread by Mehdi Mousavi | last post: by
reply views Thread by Steve B. | last post: by
2 posts views Thread by JollyK | last post: by
reply views Thread by Bhavini | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.