Thanks very much for RL and Jon's help.
Hi Rainer,
Thanks for your post. My name is Hongye Sun [MSFT] and it is my pleasure to
work with you on this issue.
Jon's answer is exactly right. You shouldn't localize the application by
using property names. They are fixed in compile time and you cannot change
it for different locale.
DataGridView designer supports to auto generates resource file for
localizable columns. You don't need to write any piece of code. Here is the
detailed steps:
1. View form properties, which contains the DataGridView.
2. Find property "Localizable" and change it to true, it will immediately
generates a resx file with localizable elements within this form.
3. View DataGridView properties, and find property "Columns" and edit it.
4. Click "Add" to add one column.
5. In "Add Column" window, choose "Unbound column" and type column's Name,
Type and HeaderText.
Name should be unique in on grid.
Type should be TextBoxColumn for display data use.
HeaderText should be the text in default language and it will be saved into
resx file.
6. Click Ok and go back to "Edit Columns" window.
7. At "Unbound Column Properties" at right side, find property
"DataPropertyName" and type the property name of your anonymous type. For
example: name, age. By setting this property, DataGridView will
automatically bind the data to this column.
8. Click Ok and go back to Form designer, save all, and double click resx
file.
9. It shows you one item with name "<Column Name>.HeaderText" and value is
what you typed just now. This indicates that the value will be displayed in
default language.
10. Go back to Form designer and open form's properties, find property
"Language", change it to one language.
11. Go to edit columns again and change the HeaderText to the specified
language text, click Ok and save all.
12. The designer will immediately generated another .<language code>.resx
file which contains the modified HeaderText.
After that, Visual Studio will compile different language resource into
satellite DLLs within different language code folders. When deploying, you
must keep them in same folder structure.
Here is the documentation for localizing windows form:
http://msdn.microsoft.com/en-us/library/9xdxwwkc.aspx.
Have a nice weekend.
Regards,
Hongye Sun (
[email protected], remove 'online.')
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.