Set Property for Controls by Name as a String

  • Thread starter Thread starter Mahmoud Al-Qudsi
  • Start date Start date
M

Mahmoud Al-Qudsi

To make it easier for translators to convert my program to their local
language, I'm using XML files as translation dictionaries since its
much easier for deployment and production purposes.

This is a sample XML File:

<translation>
<language key="en_US" rtl="false">
<form1>
<button1>Submit Form</button1>
<label1>Type your name here</label1>
</form1>
<form2>
<label1>About this Program</label1>
<button3>E&xit</button3>
</form2>
</language>
</translation>

I'm open to any all suggestions regarding the data structure, but this
seems to do what I need.
Now with an XML parser, I have all the data in strings.

in a for each loop that iterates through the contents of the
<language> sub-tree's <form*> sub-trees, how can I access the control
as a winform control?

pseudocode

for each form in language as winform
for each control in winform as generic-control
set generic-control.caption = string
.........

Any suggestions?
 
I should probably add: I'm cycling through all forms then all controls
on that form, and comparing the name of the current control to a node
of the tree, and if it's a match, I'm assigning it the value. But this
is a huge waste of resources.
 
Back
Top