Hi,
I'm working in a project where we also want to change the language on the
fly. I think you have two options:
- put a string as an identifier to the tag as proposed earlier (well you can
put a class if you need more than just a name)
- create a helper that iterates all controls from Form
(a helper for example that takea the Forms control collection and walks
through all the controls and if the control has controls in it's control
collection gets these too)
you can put all these controls to a hashtable or something while
iterating the controls check if the control you are about to add to the
hashtable is a toolbar if so iterate the toolbar.buttons-collection and find
the identifier from the tag and use that as a key for the toolbarbutton
which you will also add to the hashtable.
so eventually you will have a hashtable which holds a reference to each
control on your form and also the toolbars toolbarbuttons. Then when you
want to change the language for all these you simply get your 'texts' from
resources and you can change the texts (resource name maps to the hashtables
key)
-another option would be to use reflection to get the toolbarbutton fieds
from the form (field name maps to the resource name)
ex. you have private ToolBarbutton myFirstButton on the form and you have a
myFirstButton key in the resource files.
my 2 cents, morfy
Bill Wilson said:
Thanks for the reply.
"Anyways, there is no Name property, but if you want to save same user info
in the buttons you can always use the Tag property."
Unfortunately, I would need to store the name of the component, which I
can't get because, as you point out, it doesn't actually have one. I need to
use the name to lookup the text (and other properties) in the resource file.