For transaction purposes, I created resources files which replace text property of my winforms components.
However, it seems i can't correctly reference my DataGridViewColumn.HeaderText property manually in the resources file; but I can change the HeaderText property of it in the code, but not in the resource file (it works for other components...)
I've also tried :
DataGridViewColumn.HeaderText = "test1";
DataGridViewColumn.HeaderCell.Value = "test2";
DataGridView.Columns[1].HeaderText = "test3";
The code works when calling it but not when I put it in the resources file.
If you are using satellite assemblies for keeping localized text then you can do something like this :
//namespacaes to be imported at the top of your code file
using System.Resources;
using System.Reflection;
//source code for your method
ResourceManager resourceManager = new ResourceManager("TestSatelliteAssembly.Resources.LocalizedResources",Assembly.GetExecutingAssembly());
DataGridViewColumn.HeaderText = resourceManager.GetString("lblUserNameText");
lblUserNameText is the key for the text you are trying to localize. TestSatelliteAssembly is the name of your satellite assembly.
You can read more about satellite assemblies in my blog here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With